home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / misc / emu / ATUtilities.lha / ATUtilities / AT.c < prev    next >
C/C++ Source or Header  |  2000-09-26  |  85KB  |  2,909 lines

  1. /* ******************************************************************* */
  2. /* **                                                               ** */
  3. /* **                     ATKeyboard Version 4.0                    ** */
  4. /* **            Copright (C) 1992-1994 by Thomas Dreibholz         ** */
  5. /* **                      All rights reserved                      ** */
  6. /* **                                                               ** */
  7. /* **                         Hauptprogramm                         ** */
  8. /* **                                                               ** */
  9. /* ******************************************************************* */
  10.  
  11. #include "janus.h"
  12. #include "ATUtilities.h"
  13. #include "Display.h"
  14.  
  15. extern struct ExecBase   *SysBase;
  16. struct JanusBase         *JanusBase;
  17. struct IntuitionBase     *IntuitionBase;
  18. struct GfxBase           *GfxBase;
  19. struct DiskfontBase      *DiskfontBase;
  20. struct Library           *MathBase;
  21. struct Library           *MathTransBase;
  22. struct Library           *RexxSysBase;
  23. struct Library           *ExpansionBase;
  24. struct Library           *UtilityBase;
  25. struct Library           *AslBase;
  26. struct Library           *ATUtilitiesBase;
  27. struct Library           *TranslatorBase;
  28. struct Device            *ConsoleDevice;
  29. extern struct DosLibrary *DOSBase;
  30. extern struct Library    *IconBase;
  31.  
  32. #define MEMSIZE ((sizeof(struct SystemTime)*2)+\
  33.                  (sizeof(struct Message)*3)+\
  34.                  100+\
  35.                  sizeof(struct SHelp)+\
  36.                  sizeof(struct IOStdReq))
  37.  
  38. struct AppManager    *app;
  39. struct Window        *WindowPtr;
  40. struct Window        *RegWindow;
  41. struct TextFont      *OpalFont;
  42. struct TextFont      *SchonerFont;
  43. struct RastPort      *RastPortPtr;
  44. struct ServiceData   *TimeService;
  45. struct SHelp         *SHelp;
  46. struct ATStatus      *atstatus;
  47. struct SetupSig      *KeyboardInt;
  48. struct Task          *MainTask;
  49. struct Task          *SubTask;
  50. struct SystemTime    *SystemTime;
  51. struct SystemTime    *PublicTime;
  52. struct FileHandle    *SysTestWindow;
  53. struct FileHandle    *NIL;
  54. struct Screen        *SchonerScreen;
  55. struct Window        *SchonerWindow;
  56. struct RastPort      *SchonerRastPort;
  57. struct ViewPort      *SchonerViewPort;
  58. struct Task          *SchonerTask;
  59. struct Task          *ColorCyclingTask;
  60. struct MsgPort       *Port1,*Port2,*Port3,*Port4,*Port5;
  61. struct MsgPort       *ARexxPort,*ParallelPort;
  62. struct RexxMsg       *RexxMsg;
  63. struct Message       *Message1,*Message2,*EMessage;
  64. struct Message       *AppMessage;
  65. struct TimeServReq   *TimeReq;
  66. struct FileRequester *FileRequester;
  67. struct TagItem       *FRTags;
  68. struct IOStdReq      *ConsoleRequest;
  69. struct IOClipReq     *ClipReq;
  70. struct IOExtPar      *ParallelRequest;
  71. struct MsgPort       *ClipPort;
  72. struct Einstellungen *Prefs;
  73.  
  74. extern struct WBStartup *WBenchMsg;
  75. extern struct NewScreen  SchonerScreenDef;
  76. extern struct NewWindow  SchonerWindowDef;
  77.  
  78. LONG KickstartVersion;
  79. WORD RegTime=-1;
  80. WORD HiFiTime=-1;
  81.  
  82. LONG KeyboardSignal;
  83. ULONG KeyboardSignalMask;
  84. LONG ServiceSignal;
  85. ULONG ServiceSignalMask;
  86. LONG IntuitionSignal;
  87. ULONG IntuitionSignalMask;
  88. LONG TimerTaskSignal;
  89. ULONG TimerTaskSignalMask;
  90. LONG  ARexxSignal;
  91. ULONG ARexxSignalMask;
  92. ULONG AppSignalMask;
  93. ULONG WaitSignalMask;
  94.  
  95. UBYTE *ATName;
  96. UBYTE *Buffer;
  97. UBYTE *Chip;
  98. UBYTE  FPU;
  99. UBYTE  CPU;
  100. UBYTE ARexxLock;
  101. UBYTE ARexxMenuLock;
  102.  
  103. BOOL Online;
  104. BOOL Uhr;
  105. BOOL SystemOK;
  106. BOOL Schoner;
  107. BOOL Service;
  108. BOOL Clock;
  109. BOOL ARexx;
  110. BOOL LPT1;
  111. BOOL Speak;
  112.  
  113. APTR JanusStart;
  114. LONG ConsoleDev=-1L;
  115. LONG ClipDev=-1L;
  116.  
  117. struct KStatus
  118. {
  119.  UBYTE LShift;
  120.  UBYTE RShift;
  121.  UBYTE Ctrl;
  122.  UBYTE Alt;
  123. } kstatus=
  124. {
  125.  0,0,0,0
  126. };
  127.  
  128. VOID OpenAll();
  129. VOID CloseAll();
  130. VOID Uebertragen();
  131. VOID UebertrageClip();
  132. VOID Fehlerbehandlung();
  133. VOID LadeEinstellungen();
  134. VOID ZeigeEinstellungen();
  135. VOID SichereEinstellungen();
  136. VOID EinstellungenAendern();
  137. VOID Aktiv();
  138. VOID Inaktiv();
  139. VOID TimerTask();
  140. VOID EP();
  141. VOID Auswahl();
  142. VOID KopiereZeit();
  143. VOID KontrolliereUhr();
  144. VOID KontrolliereService();
  145. VOID KontrolliereFPU();
  146. VOID KontrolliereCPU();
  147. VOID LadeTabelle();
  148. VOID Taste();
  149. VOID SetzeTM();
  150. VOID Tastenkombination();
  151. VOID Sendung();
  152. VOID ShowInformation();
  153. VOID FTaste();
  154. VOID LeerePort();
  155. VOID LeereIDCMP();
  156. VOID UhrzeitEinsetzen();
  157. VOID DatumEinsetzen();
  158. VOID NeuerModus();
  159. VOID XLine();
  160. VOID Manager();
  161. VOID Hilfe();
  162. VOID HiFi();
  163. VOID RegCheck();
  164.  
  165. LONG         Abfrage();
  166. UBYTE       *StringAbfrage();
  167. UBYTE       *FileReq();
  168. BOOL         ErstelleTimerTask();
  169. BOOL         Requester();
  170. struct Task *CreateProcess();
  171.  
  172. UBYTE *Wochentage[]={"Sonntag",
  173.                      "Montag",
  174.                      "Dienstag",
  175.                      "Mittwoch",
  176.                      "Donnerstag",
  177.                      "Freitag",
  178.                      "Samstag"};
  179.  
  180. UBYTE *TSRWochentage[]={"Sun","Mon",
  181.                         "Tue","Wed",
  182.                         "Thu","Fri",
  183.                         "Sat"};
  184. UBYTE *Monate[]={"",
  185.                  "Januar",
  186.                  "Februar",
  187.                  "März",
  188.                  "April",
  189.                  "Mai",
  190.                  "Juni",
  191.                  "Juli",
  192.                  "August",
  193.                  "September",
  194.                  "Oktober",
  195.                  "November",
  196.                  "Dezember"};
  197.  
  198. UBYTE *TSRMonate[]={"",
  199.                     "Jan","Feb","Mar","Apr",
  200.                     "May","Jun","Jul","Aug",
  201.                     "Sep","Oct","Nov","Dec"};
  202.  
  203. UBYTE TastenTabelle[256];
  204. UBYTE FileBuffer[128];
  205.  
  206. struct KeyCodes *KeyCodes;
  207.  
  208. UBYTE Druck[]={ 4, 0x60,0x5d,0x5d|BIT7,0x60|BIT7};
  209. UBYTE Break[]={ 4, 0x63,0x5b,0x5b|BIT7,0x63|BIT7};
  210. UBYTE USEin[]={ 6, 0x63,0x64,0x50,0x50|BIT7,0x64|BIT7,0x63|BIT7};
  211. UBYTE USAus[]={ 6, 0x63,0x64,0x51,0x51|BIT7,0x64|BIT7,0x63|BIT7};
  212. UBYTE Reset[]={ 6, 0x63,0x64,0x46,0x46|BIT7,0x64|BIT7,0x63|BIT7};
  213. UBYTE Setup[]={ 6, 0x63,0x64,0x45,0x45|BIT7,0x64|BIT7,0x63|BIT7};
  214. UBYTE MKAuf[]={16, 0x63,0x64,0x50,0x50|BIT7,0x64|BIT7,0x63|BIT7,
  215.                    0x60,0x1a,0x1a|BIT7,0x60|BIT7,
  216.                    0x63,0x64,0x51,0x51|BIT7,0x64|BIT7,0x63|BIT7};
  217. UBYTE MKZu[]= {16, 0x63,0x64,0x50,0x50|BIT7,0x64|BIT7,0x63|BIT7,
  218.                    0x60,0x1b,0x1b|BIT7,0x60|BIT7,
  219.                    0x63,0x64,0x51,0x51|BIT7,0x64|BIT7,0x63|BIT7};
  220. UBYTE IKAuf[]={14, 0x63,0x64,0x50,0x50|BIT7,0x64|BIT7,0x63|BIT7,
  221.                    0x1a,0x1a|BIT7,
  222.                    0x63,0x64,0x51,0x51|BIT7,0x64|BIT7,0x63|BIT7};
  223. UBYTE IKZu[]= {14, 0x63,0x64,0x50,0x50|BIT7,0x64|BIT7,0x63|BIT7,
  224.                    0x1b,0x1b|BIT7,
  225.                    0x63,0x64,0x51,0x51|BIT7,0x64|BIT7,0x63|BIT7};
  226. UBYTE Apo[]=  {14, 0x63,0x64,0x50,0x50|BIT7,0x64|BIT7,0x63|BIT7,
  227.                    0x2a,0x2a|BIT7,
  228.                    0x63,0x64,0x51,0x51|BIT7,0x64|BIT7,0x63|BIT7};
  229. UBYTE PL[]=   {4,  0x63,0x45,0x45|BIT7,0x63|BIT7};
  230. UBYTE NE[]=   {4,  0x64,0x45,0x45|BIT7,0x64|BIT7};
  231. UBYTE LA[]=   {6,  0x60,0x64,0x45,0x45|BIT7,0x64|BIT7,0x60|BIT7};
  232. UBYTE EN[]=   {4,  0x64,0x53,0x53|BIT7,0x64|BIT7};
  233. UBYTE TxLad[]={6,  0x45,0x45|BIT7,
  234.                    0x1a,0x1a|BIT7,
  235.                    0x28,0x28|BIT7};
  236. UBYTE TxSi[]= {6,  0x45,0x45|BIT7,
  237.                    0x1a,0x1a|BIT7,
  238.                    0x21,0x21|BIT7};
  239. UBYTE Lay[]=  {6,  0x45,0x45|BIT7,
  240.                    0x22,0x22|BIT7,
  241.                    0x28,0x28|BIT7};
  242. UBYTE Drck[]= {6,  0x45,0x45|BIT7,
  243.                    0x22,0x22|BIT7,
  244.                    0x22,0x22|BIT7};
  245.  
  246. #define xITEMENABLED (0xffff-ITEMENABLED)
  247. #define xMENUENABLED (0xffff-MENUENABLED)
  248. #define xCHECKED     (0xffff-CHECKED)
  249.  
  250. /* *********************************************************************
  251.    ****************** Hauptprogramm ************************************
  252.    ********************************************************************* */
  253.  
  254.  
  255. VOID main(argc,argv)
  256.  LONG argc;
  257.  UBYTE *argv[];
  258. {
  259.  UBYTE                SayTModus[44];
  260.  UBYTE               *name;
  261.  ULONG                Signale;
  262.  ULONG                Class;
  263.  UWORD                Code;
  264.  UWORD                Qualifier;
  265.  UWORD                MenuNum,
  266.                       ItemNum,
  267.                       SubItemNum;
  268.  BOOL                 bool;
  269.  struct IntuiMessage *IMessage;
  270.  
  271.  if(argc!=0)
  272.   {
  273.    ATName=argv[0];
  274.   }
  275.  
  276.  if(argc>=2)
  277.   {
  278.    printf("\n\n\n%s\n%s\n\n",Copyright[0],Copyright[4]);
  279.    LadeEinstellungen(FALSE);
  280.    printf(" ARexx-Port: %s\n",ARexxName);
  281.    printf(" ARexx-Befehlsübersicht mit\n");
  282.    printf("    rx \"address '%s' help\"\n\n",ARexxName);
  283.    printf("Weitere Informationen finden Sie\nin der Dokumentationsdatei.\n\n\n");
  284.    exit(0);
  285.   }
  286.  OpenAll();
  287.  FOREVER
  288.   {
  289.    Signale=Wait(WaitSignalMask);
  290.    if(Signale & IntuitionSignalMask)
  291.     {
  292.      IMessage=GetMsg(WindowPtr->UserPort);
  293.      if(IMessage!=NULL)
  294.       {
  295.        do
  296.         {
  297.          Class=IMessage->Class;
  298.          Code=IMessage->Code;
  299.          Qualifier=IMessage->Qualifier;
  300.          ReplyMsg(IMessage);
  301.          switch(Class)
  302.           {
  303.            case RAWKEY:
  304.              if(Online==TRUE)
  305.               {
  306.                if((Qualifier & IEQUALIFIER_RCOMMAND) ||
  307.                   (Qualifier & IEQUALIFIER_LCOMMAND))
  308.                 {
  309.                  if((Code>=0x50)&&(Code<=0x59))
  310.                   {
  311.                    FTaste(Code-0x50,Qualifier);
  312.                   }
  313.                  else
  314.                   {
  315.                    Taste(Code,Qualifier);
  316.                   }
  317.                 }
  318.                else
  319.                 {
  320.                  Taste(Code,Qualifier);
  321.                 }
  322.               }
  323.             break;
  324.            case CHANGEWINDOW:
  325.              ClearMenuStrip(WindowPtr);
  326.              if(WindowPtr->Flags & WFLG_ZOOMED)
  327.               {
  328.                if(Clock==FALSE)
  329.                 {
  330.                  Clock=TRUE;
  331.                  Einstellungen.Uhr=1;
  332.                  Aktiv(&Uhr_Item);
  333.                 }
  334.               }
  335.              else
  336.               {
  337.                if(Clock==TRUE)
  338.                 {
  339.                  Clock=FALSE;
  340.                  Einstellungen.Uhr=0;
  341.                  Inaktiv(&Uhr_Item);
  342.                 }
  343.               }
  344.              SetMenuStrip(WindowPtr,&Menu1);
  345.              KontrolliereUhr();
  346.             break;
  347.            case MENUHELP:
  348.              if(RegWindow!=NULL)
  349.               {
  350.                if(RegTime>0)
  351.                 {
  352.                  DeleteStdWindow(RegWindow);
  353.                  RegWindow=NULL;
  354.                 }
  355.               }
  356.              MenuNum=MENUNUM(Code);
  357.              ItemNum=ITEMNUM(Code);
  358.              SubItemNum=SUBNUM(Code);
  359.              printf("Menuhelp: %ld %ld %ld\n",MenuNum,ItemNum,SubItemNum);
  360.             break;
  361.            case MENUPICK:
  362.              if(RegWindow!=NULL)
  363.               {
  364.                if(RegTime>0)
  365.                 {
  366.                  DeleteStdWindow(RegWindow);
  367.                  RegWindow=NULL;
  368.                 }
  369.               }
  370.              MenuNum=MENUNUM(Code);
  371.              ItemNum=ITEMNUM(Code);
  372.              SubItemNum=SUBNUM(Code);
  373.              switch(MenuNum)
  374.               {
  375.                case MENU_DATEI:
  376.                  switch(ItemNum)
  377.                   {
  378.                    case ITEM_EINSTELLUNGEN_LADEN:
  379.                      Say("reading old preferences");
  380.                      LadeEinstellungen(TRUE);
  381.                      ZeigeEinstellungen(TRUE);
  382.                     break;
  383.                    case ITEM_EINSTELLUNGEN_SICHERN:
  384.                      Say("writing new preferences");
  385.                      SichereEinstellungen();
  386.                     break;
  387.                    case ITEM_EINSTELLUNGEN_AENDERN3:
  388.                      EinstellungenAendern();
  389.                      switch(SubItemNum)
  390.                       {
  391.                        case SUBITEM_A2286:
  392.                          ClearMenuStrip(WindowPtr);
  393.                          if(Einstellungen.A2286)
  394.                           {
  395.                            Setup_Item.Flags |= ITEMENABLED;
  396.                           }
  397.                          else
  398.                           {
  399.                            Setup_Item.Flags &= xITEMENABLED;
  400.                           }
  401.                          SetMenuStrip(WindowPtr,&Menu1);
  402.                         break;
  403.                        case SUBITEM_M68881:
  404.                          if(Schoner==FALSE)
  405.                           {
  406.                            KontrolliereFPU();
  407.                           }
  408.                          else
  409.                           {
  410.                            ClearMenuStrip(WindowPtr);
  411.                            if(M68881_Item.Flags & CHECKED) M68881_Item.Flags |= CHECKED; else M68881_Item.Flags &= xCHECKED;
  412.                            SetMenuStrip(WindowPtr,&Menu1);
  413.                           }
  414.                         break;
  415.                        case SUBITEM_DATACACHE:
  416.                        case SUBITEM_M68020:
  417.                          KontrolliereCPU();
  418.                         break;
  419.                        case SUBITEM_PRIORITAET:
  420.                          Einstellungen.Prioritaet=Abfrage("Programmpriorität (-128 bis 127):",
  421.                                                            Einstellungen.Prioritaet,-128,127,1);
  422.                          SetTaskPri(MainTask,Einstellungen.Prioritaet);
  423.                         break;
  424.                       }
  425.                     break;
  426.                    case ITEM_EINSTELLUNGEN_AENDERN2:
  427.                      EinstellungenAendern();
  428.                      switch(SubItemNum)
  429.                       {
  430.                        case SUBITEM_TIMESERVICE:
  431.                          if(Einstellungen.TimeService) Service=TRUE; else Service=FALSE;
  432.                          KontrolliereService();
  433.                         break;
  434.                        case SUBITEM_LPT1:
  435.                          if(Einstellungen.LPT1Verwaltung) LPT1=TRUE; else LPT1=FALSE;
  436.                          KontrolliereLPT1();
  437.                         break;
  438.                        case SUBITEM_UHR:
  439.                          if(Einstellungen.Uhr) Clock=TRUE; else Clock=FALSE;
  440.                          KontrolliereUhr();
  441.                         break;
  442.                        case SUBITEM_SPEAK:
  443.                          if(Einstellungen.Speak) Speak=TRUE; else Speak=FALSE;
  444.                          Say("narrator turned on");
  445.                         break;
  446.                        case SUBITEM_SPEAKPREFS:
  447.                          NarratorPrefs();
  448.                         break;
  449.                        case SUBITEM_AREXX:
  450.                          ARexxName=StringAbfrage(FALSE,"Neuer Name für den ARexx-Port:",ARexxName);
  451.                        break;
  452.                       }
  453.                     break;
  454.                    case ITEM_EINSTELLUNGEN_AENDERN1:
  455.                      EinstellungenAendern();
  456.                      switch(SubItemNum)
  457.                       {
  458.                        case SUBITEM_UEBERTRAGUNGSRATE:
  459.                          Say("editing keyboard transfer rate");
  460.                          Einstellungen.Uebertragungsrate=Abfrage("Übertragungsrate in 0.02s:",
  461.                                                                  Einstellungen.Uebertragungsrate,0,120,1);
  462.                         break;
  463.                       }
  464.                     break;
  465.                    case ITEM_UEBERTRAGEN:
  466.                      switch(SubItemNum)
  467.                       {
  468.                        case SUBITEM_ASCDATEI:
  469.                          Say("ascii transfer form a file");
  470.                          Uebertragen();
  471.                         break;
  472.                        case SUBITEM_CLIP:
  473.                          Say("ascii transfer from the clipboard");
  474.                          UebertrageClip();
  475.                         break;
  476.                       }
  477.                     break;
  478.                    case ITEM_ERWEITERUNGEN:
  479.                      if(Erweiterungen_Item.SubItem!=NULL)
  480.                       {
  481.                        CallUtilityList(SubItemNum);
  482.                       }
  483.                     break;
  484.                    case ITEM_MANAGER:
  485.                      Say("trying to run the utility manager");
  486.                      Manager();
  487.                     break;
  488.                    case ITEM_ENDE:
  489.                      if(ARexxLock==0) CloseAll(); else DisplayBeep(NULL);
  490.                     break;
  491.                    case ITEM_INFORMATION:
  492.                      if(Schoner==TRUE) WBenchToFront();
  493.                      Say("showing informations about a t keyboard");
  494.                      ShowInformation(TRUE);
  495.                      if(Schoner==TRUE) ScreenToFront(SchonerScreen);
  496.                     break;
  497.                   }
  498.                 break;
  499.                case MENU_TASTATUR:
  500.                 switch(ItemNum)
  501.                  {
  502.                   case ITEM_TASTATURMODUS:
  503.                     if((SubItemNum>=0)&&(SubItemNum<=7))
  504.                      {
  505.                       sprintf(&SayTModus,"you have selected keyboard mode number %d\n",SubItemNum);
  506.                       NeuerModus(SubItemNum,TRUE);
  507.                      }
  508.                     else
  509.                      {
  510.                       switch(SubItemNum)
  511.                        {
  512.                         case SUBITEM_TMEDITOR:
  513.                           ClearMenuStrip(WindowPtr);
  514.                           Say("calling the keyboard mode editor");
  515.                           TMEditor();
  516.                           SetMenuStrip(WindowPtr,&Menu1);
  517.                          break;
  518.                         case SUBITEM_TMONOFF:
  519.                           ClearMenuStrip(WindowPtr);
  520.                           TMOnOff();
  521.                           SetMenuStrip(WindowPtr,&Menu1);
  522.                          break;
  523.                        }
  524.                      }
  525.                    break;
  526.                   case ITEM_F:
  527.                     switch(SubItemNum)
  528.                      {
  529.                       case SUBITEM_F_AENDERN:
  530.                         ClearMenuStrip(WindowPtr);
  531.                         Say("calling the f key editor");
  532.                         FTastenAendern();
  533.                         SetMenuStrip(WindowPtr,&Menu1);
  534.                        break;
  535.                       case SUBITEM_F_ZEIGEN:
  536.                         ClearMenuStrip(WindowPtr);
  537.                         ZeigeFTasten();
  538.                         SetMenuStrip(WindowPtr,&Menu1);
  539.                        break;
  540.                      }
  541.                    break;
  542.                   case ITEM_ONLINE:
  543.                     XLine(TRUE);
  544.                     Say("a t keyboard is online");
  545.                    break;
  546.                   case ITEM_OFFLINE:
  547.                     XLine(FALSE);
  548.                     Say("a t keyboard is offline");
  549.                    break;
  550.                   case ITEM_SYSTEMTEST:
  551.                     if(SysTest_Item.Flags & CHECKED)
  552.                      {
  553.                       if(SysTestWindow==NULL)
  554.                        {
  555.                         SysTestWindow=Open("CON:20/10/600/150/ATKeyboard - System Test",MODE_NEWFILE);
  556.                         if(SysTestWindow==NULL)
  557.                          {
  558.                           ClearMenuStrip(WindowPtr);
  559.                           Inaktiv(&SysTest_Item);
  560.                           SetMenuStrip(WindowPtr,&Menu1);
  561.                          }
  562.                         else
  563.                          { Say("opening test window"); }
  564.                         ActivateWindow(WindowPtr);
  565.                        }
  566.                      }
  567.                     else
  568.                      {
  569.                       if(SysTestWindow) Close(SysTestWindow);
  570.                       Say("removing test window");
  571.                       SysTestWindow=NULL;
  572.                      }
  573.                    break;
  574.                  }
  575.                 break;
  576.                case MENU_BEFEHLE:
  577.                  if(Online==TRUE)
  578.                   {
  579.                    switch(ItemNum)
  580.                     {
  581.                      case ITEM_ANWENDUNGEN:
  582.                        switch(SubItemNum)
  583.                         {
  584.                          case SUBITEM_PROGRAMMLISTE:
  585.                            Say("open task list");
  586.                            Tastenkombination(&PL);
  587.                           break;
  588.                          case SUBITEM_NEXT:
  589.                            Say("run next program");
  590.                            Tastenkombination(&NE);
  591.                           break;
  592.                          case SUBITEM_LAST:
  593.                            Say("run previous program");
  594.                            Tastenkombination(&LA);
  595.                           break;
  596.                          case SUBITEM_END:
  597.                            Say("quit");
  598.                            Tastenkombination(&EN);
  599.                           break;
  600.                          case SUBITEM_TEXTLADEN:
  601.                            Say("load text");
  602.                            Tastenkombination(&TxLad);
  603.                           break;
  604.                          case SUBITEM_TEXTSICHERN:
  605.                            Say("save text");
  606.                            Tastenkombination(&TxSi);
  607.                           break;
  608.                          case SUBITEM_LAYOUT:
  609.                            Say("layout check");
  610.                            Tastenkombination(&Lay);
  611.                           break;
  612.                          case SUBITEM_DRUCKEN:
  613.                            Say("print");
  614.                            Tastenkombination(&Drck);
  615.                           break;
  616.                         }
  617.                       break;
  618.                      case ITEM_DRUCK:
  619.                        Say("hardcopy");
  620.                        Tastenkombination(&Druck);
  621.                       break;
  622.                      case ITEM_BREAK:
  623.                        Say("break");
  624.                        Tastenkombination(&Break);
  625.                       break;
  626.                      case ITEM_US_EIN:
  627.                        Say("turning on u s mode");
  628.                        Tastenkombination(&USEin);
  629.                       break;
  630.                      case ITEM_US_AUS:
  631.                        Say("turning off u s mode");
  632.                        Tastenkombination(&USAus);
  633.                       break;
  634.                      case ITEM_MENGENKLAMMER_AUF:
  635.                        Tastenkombination(&MKAuf);
  636.                       break;
  637.                      case ITEM_MENGENKLAMMER_ZU:
  638.                        Tastenkombination(&MKZu);
  639.                       break;
  640.                      case ITEM_INDEXKLAMMER_AUF:
  641.                        Tastenkombination(&IKAuf);
  642.                       break;
  643.                      case ITEM_INDEXKLAMMER_ZU:
  644.                        Tastenkombination(&IKZu);
  645.                       break;
  646.                      case ITEM_APOSTROPH:
  647.                        Tastenkombination(&Apo);
  648.                       break;
  649.                      case ITEM_UHRZEIT:
  650.                        Say("inserting time");
  651.                        UhrzeitEinsetzen();
  652.                       break;
  653.                      case ITEM_DATUM:
  654.                        Say("inserting date");
  655.                        DatumEinsetzen();
  656.                       break;
  657.                      case ITEM_RESET:
  658.                        Say("warmstart");
  659.                        Tastenkombination(&Reset);
  660.                       break;
  661.                      case ITEM_SETUP:
  662.                        Say("a t setup");
  663.                        Tastenkombination(&Setup);
  664.                       break;
  665.                      case ITEM_KALTSTART:
  666.                        Say("coldstart");
  667.                        ResetPC();
  668.                       break;
  669.                      }
  670.                    }
  671.                   break;
  672.                  case MENU_SCHONER:
  673.                    switch(ItemNum)
  674.                     {
  675.                      case ITEM_SCHONER_EIN:
  676.                        if(Schoner==FALSE)
  677.                         {
  678.                          Schoner=TRUE;
  679.                          KontrolliereSchoner();
  680.                         }
  681.                       break;
  682.                      case ITEM_SCHONER_AUS:
  683.                        if(Schoner==TRUE);
  684.                         {
  685.                          Schoner=FALSE;
  686.                          KontrolliereSchoner();
  687.                         }
  688.                       break;
  689.                      case ITEM_GRAFIK:
  690.                        EinstellungenAendern();
  691.                       break;
  692.                      case ITEM_GRAFIKWECHSEL:
  693.                        switch(SubItemNum)
  694.                         {
  695.                          case SUBITEM_GESCHWINDIGKEIT:
  696.                            Einstellungen.GrafikGeschwindigkeit=Abfrage("Zeit pro Grafik in Sekunden:",
  697.                                                                        Einstellungen.GrafikGeschwindigkeit,
  698.                                                                        2,600,2);
  699.                           break;
  700.                          case SUBITEM_TASKPRIORITAET:
  701.                            Einstellungen.SchonerPrioritaet=Abfrage("Priorität des Schonergrafik-Tasks:",
  702.                                                                    Einstellungen.SchonerPrioritaet,
  703.                                                                    -128,127,1);
  704.                           break;
  705.                         }
  706.                       break;
  707.                      case ITEM_FARBROLLEN:
  708.                        switch(SubItemNum)
  709.                         {
  710.                          case SUBITEM_GESCHWINDIGKEIT:
  711.                            Einstellungen.FarbrollGeschwindigkeit=Abfrage("Farbroll-Geschwindigkeit in 0.02s:",
  712.                                                                          Einstellungen.FarbrollGeschwindigkeit,
  713.                                                                          1,120,1);
  714.                           break;
  715.                          case SUBITEM_TASKPRIORITAET:
  716.                            Einstellungen.FarbrollPrioritaet=Abfrage("Priorität des Farbroll-Tasks:",
  717.                                                                     Einstellungen.FarbrollPrioritaet,
  718.                                                                     -128,127,1);
  719.                           break;
  720.                         }
  721.                       break;
  722.                      case ITEM_PAL:
  723.                        EinstellungenAendern();
  724.                       break;
  725.                     }
  726.                   break;
  727.                  case MENU_LPT1:
  728.                    switch(ItemNum)
  729.                     {
  730.                      case ITEM_KONTROLLFENSTER:
  731.                        if(Kontrollfenster_Item.Flags & CHECKED)
  732.                         {
  733.                          Einstellungen.Kontrollfenster=YES;
  734.                         }
  735.                        else
  736.                         {
  737.                          Einstellungen.Kontrollfenster=NO;
  738.                         }
  739.                       break;
  740.                      case ITEM_DRUCKERRESET:
  741.                        Druckerreset();
  742.                       break;
  743.                      case ITEM_DRUCKERCACHE:
  744.                        switch(SubItemNum)
  745.                         {
  746.                          case SUBITEM_GROESSE:
  747.                            Einstellungen.Puffergroesse=Abfrage("Größe des Druckerpuffers in Bytes:",
  748.                                                                 Einstellungen.Puffergroesse,
  749.                                                                 500,999999,2500);
  750.                           break;
  751.                          case SUBITEM_ZEIT:
  752.                            Einstellungen.Leerungszeit=Abfrage("Leerungsabstand des Caches in 0.02s:",
  753.                                                                Einstellungen.Leerungszeit,
  754.                                                                3,2500,5);
  755.                           break;
  756.                          case SUBITEM_LED:
  757.  
  758.                            EinstellungenAendern();
  759.                           break;
  760.                         }
  761.                       break;
  762.                      case ITEM_DRUCKZIEL:
  763.                        ClearMenuStrip(WindowPtr);
  764.                        switch(SubItemNum)
  765.                         {
  766.                          case SUBITEM_PARALLEL:
  767.                            Inaktiv(&ZuDatei_Item);
  768.                            Inaktiv(&PrtPort_Item);
  769.                            Aktiv(&ParPort_Item);
  770.                            Say("the l p t 1 emulation will transfer the data to the parallel port after the next l p t 1 reset");
  771.                            Einstellungen.Umlenkung=0;
  772.                           break;
  773.                          case SUBITEM_PRINTER:
  774.                            Inaktiv(&ZuDatei_Item);
  775.                            Inaktiv(&ParPort_Item);
  776.                            Aktiv(&PrtPort_Item);
  777.                            Say("the l p t 1 emulation will transfer the data to the printer driver chosen by preferences after the next l p t 1 reset");
  778.                            Einstellungen.Umlenkung=1;
  779.                            break;
  780.                          case SUBITEM_DATEI:
  781.                            Inaktiv(&ParPort_Item);
  782.                            Inaktiv(&PrtPort_Item);
  783.                            Aktiv(&ZuDatei_Item);
  784.                            Say("the l p t 1 emulation will transfer the data to a file after the next l p t 1 reset");
  785.                            Einstellungen.Umlenkung=2;
  786.                           break;
  787.                          case SUBITEM_DATEINAME:
  788.                            Say("editing the l p t 1 output file's name");
  789.                            if(FileRequester!=NULL)
  790.                             {
  791.                              name=FileReq("LPT1-Ausgabedatei","~(#?.info)");
  792.                             }
  793.                            else
  794.                             {
  795.                              name=StringAbfrage(FALSE,"Name der LPT1-Ausgabedatei:","");
  796.                             }
  797.                            strcpy(&Einstellungen.LPT1Name,name);
  798.                           break;
  799.                         }
  800.                        SetMenuStrip(WindowPtr,&Menu1);
  801.                       break;
  802.                     }
  803.                   break;
  804.                  case MENU_ATPREFS:
  805.                    ATPrefs(ItemNum,SubItemNum);
  806.                   break;
  807.                  case MENU_HIFI:
  808.                    HiFi(ItemNum,SubItemNum);
  809.                   break;
  810.                  case MENU_HILFE:
  811.                    Hilfe(ItemNum);
  812.                   break;
  813.                 break;
  814.               }
  815.             break;
  816.            case CLOSEWINDOW:
  817.              if(ARexxLock==0) CloseAll(); else DisplayBeep(NULL);
  818.             break;
  819.           }
  820.          IMessage=GetMsg(WindowPtr->UserPort);
  821.         } while(IMessage!=NULL);
  822.       }
  823.     }
  824.    if(Signale & ServiceSignalMask)
  825.     {
  826.      KopiereZeit();
  827.      TimeService=MakeBytePtr(TimeService);
  828.      JanusLock(&TimeService->ServiceDataLock);
  829.      TimeReq=MakeWordPtr(TimeReq);
  830.      TimeReq->Year=PublicTime->Year;
  831.      TimeReq=MakeBytePtr(TimeReq);
  832.      TimeReq->Month=PublicTime->Month;
  833.      TimeReq->Day=PublicTime->Day;
  834.      TimeReq->Seconds=PublicTime->Seconds;
  835.      TimeReq->Minutes=PublicTime->Minutes;
  836.      TimeReq->Hour=PublicTime->Hours;
  837.      sprintf(&TimeReq->String,"%s %s %02ld %02ld:%02ld:%02ld %ld%c%c%c",
  838.             TSRWochentage[PublicTime->DayNum],
  839.             TSRMonate[PublicTime->Month],
  840.             PublicTime->Day,
  841.             PublicTime->Hours,
  842.             PublicTime->Minutes,
  843.             PublicTime->Seconds,
  844.             PublicTime->Year,
  845.             13,10,36);
  846.      TimeReq=MakeWordPtr(TimeReq);
  847.      TimeReq->Err=0;
  848.      TimeReq=MakeBytePtr(TimeReq);
  849.      JanusUnlock(&TimeService->ServiceDataLock);
  850.      CallService(TimeService);
  851.     }
  852.    if(Signale & ARexxSignalMask)
  853.     {
  854.      RexxMsg=GetMsg(ARexxPort);
  855.      if(RexxMsg!=NULL)
  856.       {
  857.        if(ARexxIO_Item.Flags & CHECKED) bool=FALSE; else bool=TRUE;
  858.        HandleRexxMsg(RexxMsg,bool);
  859.       }
  860.     }
  861.    if(Signale & TimerTaskSignalMask)
  862.     {
  863.      if(Uhr==TRUE)
  864.       {
  865.        KopiereZeit();
  866.        SetAPen(RastPortPtr,1);
  867.        sprintf(Buffer,"%ld:%02ld:%02ld      ",PublicTime->Hours,
  868.                                                PublicTime->Minutes,
  869.                                                PublicTime->Seconds);
  870.        WriteText(RastPortPtr,28,30,Buffer);
  871.        sprintf(Buffer,"%s, der %ld. %s %ld",Wochentage[PublicTime->DayNum],
  872.                                             PublicTime->Day,
  873.                                             Monate[PublicTime->Month],
  874.                                             PublicTime->Year);
  875.        WriteText(RastPortPtr,125,30,Buffer);
  876.       }
  877.      if(HiFiTime>0)
  878.       {
  879.        HiFiTime--;
  880.        if(HiFiTime==0)
  881.         {
  882.          HiFi(7466,0);
  883.          HiFiTime=-1;
  884.         }
  885.       }
  886.      if(RegWindow!=NULL)
  887.       {
  888.        if(RegTime>0)
  889.         {
  890.          RegTime--;
  891.          if(RegTime==0)
  892.           {
  893.            DeleteStdWindow(RegWindow);
  894.            RegWindow=NULL;
  895.           }
  896.         }
  897.        if(RegTime<0)
  898.         {
  899.          RegTime--;
  900.          if((RegTime % 4)==0) WindowToFront(RegWindow);
  901.         }
  902.       }
  903.     }
  904.    if(app!=NULL)
  905.     {
  906.      if(Signale & AppSignalMask)
  907.       {
  908.        AppMessage=GetMsg(app->Port);
  909.        if(AppMessage!=NULL)
  910.         {
  911.          ReplyMsg(AppMessage);
  912.          WindowToFront(WindowPtr);
  913.          ActivateWindow(WindowPtr);
  914.          XLine(TRUE);
  915.         }
  916.       }
  917.     }
  918.   }
  919. }
  920.  
  921.  
  922. /* *********************************************************************
  923.    ****************** Unterprogramme ***********************************
  924.    ********************************************************************* */
  925.  
  926.  
  927. /* Abfrage-Routine */
  928. LONG Abfrage(text,aktuell,min,max,pm)
  929.  UBYTE *text;
  930.  LONG aktuell,min,max,pm;
  931. {
  932.  REGISTER BOOL                 ende=TRUE;
  933.  UBYTE                         B1[9];
  934.  REGISTER LONG                 i;
  935.  REGISTER UBYTE               *Titel,*buffer;
  936.  ULONG                         Class;
  937.  UWORD                         id;
  938.  register struct Gadget       *gad;
  939.  register struct Window       *AbfrageWindow;
  940.  register struct RastPort     *AbfrageRastPort;
  941.  register struct IntuiMessage *IMessage;
  942.  
  943.  ClearMenuStrip(WindowPtr);
  944.  Titel=WindowPtr->Title;
  945.  SetWindowTitles(WindowPtr,TitelText,TitelText);
  946.  if(Schoner==TRUE) WBenchToFront();
  947.  
  948.  sprintf(&B1,"%ld",aktuell);
  949.  AbfrageWindow=CreateStdWindow("ATKeyboard - Einstellungen",75,75,450,38+BorderHeight(),
  950.                                CLOSEWINDOW|GADGETUP,WINDOWDEPTH|WINDOWDRAG|WINDOWCLOSE|ACTIVATE|GIMMEZEROZERO);
  951.  if(AbfrageWindow!=NULL)
  952.   {
  953.    /* ----- Gadgets und Text zeichnen --------------------- */
  954.    AbfrageRastPort=AbfrageWindow->RPort;
  955.    SetFont(AbfrageRastPort,OpalFont);
  956.    SelectStdFPen(AbfrageRastPort);
  957.    WriteText(AbfrageRastPort,10,13,text);
  958.    CreateBoolGadget(AbfrageWindow,15,20,100,12,"Okay",2);
  959.    CreateBoolGadget(AbfrageWindow,335,20,100,12,"Abbruch",3);
  960.    buffer=CreateIntegerGadget(AbfrageWindow,338,5,72,12,&B1,8,1);
  961.    CreateMinGadget(AbfrageWindow,313,5,20,12,10);
  962.    CreateMinGadget(AbfrageWindow,415,5,20,12,20);
  963.    DrawPTextBorder(AbfrageWindow,313,5,20,12,"«");
  964.    DrawPTextBorder(AbfrageWindow,415,5,20,12,"»");
  965.  
  966.    /* ----- Abfrage --------------------------------------- */
  967.  
  968.    ende=FALSE;
  969.    while(ende==FALSE)
  970.     {
  971.      WaitPort(AbfrageWindow->UserPort);
  972.      IMessage=GetMsg(AbfrageWindow->UserPort);
  973.      Class=IMessage->Class;
  974.      gad=IMessage->IAddress;
  975.      ReplyMsg(IMessage);
  976.      switch(Class)
  977.       {
  978.        case CLOSEWINDOW:
  979.          i=aktuell;
  980.          ende=TRUE;
  981.         break;
  982.        case GADGETUP:
  983.          id=gad->GadgetID;
  984.          i=atol(buffer);
  985.          switch(id)
  986.           {
  987.            case 1:
  988.            case 2:
  989.              if(i>max) i=max;
  990.              if(i<min) i=min;
  991.              ende=TRUE;
  992.             break;
  993.            case 10:
  994.              i=i-pm;
  995.              if(i>max) i=max;
  996.              if(i<min) i=min;
  997.              sprintf(buffer,"%ld",i);
  998.              RefreshGadgets(AbfrageWindow->FirstGadget,AbfrageWindow,NULL);
  999.             break;
  1000.            case 20:
  1001.              i=i+pm;
  1002.              if(i>max) i=max;
  1003.              if(i<min) i=min;
  1004.              sprintf(buffer,"%ld",i);
  1005.              RefreshGadgets(AbfrageWindow->FirstGadget,AbfrageWindow,NULL);
  1006.             break;
  1007.            case 3:
  1008.              i=aktuell;
  1009.              ende=TRUE;
  1010.             break;
  1011.           }
  1012.         break;
  1013.       }
  1014.     }
  1015.   }
  1016.  else
  1017.   {
  1018.    i=aktuell;
  1019.   }
  1020.  if(Schoner==TRUE) ScreenToFront(SchonerScreen);
  1021.  CloseWindow(AbfrageWindow);
  1022.  ActivateWindow(WindowPtr);
  1023.  SetMenuStrip(WindowPtr,&Menu1);
  1024.  SetWindowTitles(WindowPtr,Titel,TitelText);
  1025.  return(i);
  1026. }
  1027.  
  1028.  
  1029. /* Abfrage-Routine für Strings */
  1030. UBYTE *StringAbfrage(bool,text,aktuell)
  1031.  BOOL   bool;
  1032.  UBYTE *text;
  1033.  UBYTE *aktuell;
  1034. {
  1035.  REGISTER UBYTE               *Titel;
  1036.  REGISTER UBYTE               *r,*buffer;
  1037.  ULONG                         Class;
  1038.  UWORD                         id;
  1039.  register struct Gadget       *gad;
  1040.  register struct Window       *AbfrageWindow;
  1041.  register struct RastPort     *AbfrageRastPort;
  1042.  register struct IntuiMessage *IMessage;
  1043.  
  1044.  ClearMenuStrip(WindowPtr);
  1045.  Titel=WindowPtr->Title;
  1046.  SetWindowTitles(WindowPtr,TitelText,TitelText);
  1047.  if(Schoner==TRUE) WBenchToFront();
  1048.  r=aktuell;
  1049.  
  1050.  AbfrageWindow=CreateStdWindow("ATKeyboard - Einstellungen",75,75,450,52+BorderHeight(),
  1051.                                CLOSEWINDOW|GADGETUP,WINDOWCLOSE|WINDOWDEPTH|WINDOWDRAG|ACTIVATE|GIMMEZEROZERO);
  1052.  if(AbfrageWindow!=NULL)
  1053.   {
  1054.    /* ----- Gadgets und Text zeichnen --------------------- */
  1055.    AbfrageRastPort=AbfrageWindow->RPort;
  1056.    SetFont(AbfrageRastPort,OpalFont);
  1057.    SelectStdFPen(AbfrageRastPort);
  1058.    buffer=CreateStringGadget(AbfrageWindow,15,18,420,12,r,128,1);
  1059.    CreateBoolGadget(AbfrageWindow,15,34,100,12,"Okay",2);
  1060.    CreateBoolGadget(AbfrageWindow,335,34,100,12,"Abbruch",3);
  1061.    WriteText(AbfrageRastPort,20,12,text);
  1062.  
  1063.    /* ----- Abfrage --------------------------------------- */
  1064.    WaitPort(AbfrageWindow->UserPort);
  1065.    IMessage=GetMsg(AbfrageWindow->UserPort);
  1066.    Class=IMessage->Class;
  1067.    gad=IMessage->IAddress;
  1068.    ReplyMsg(IMessage);
  1069.    id=3;
  1070.    if(Class==GADGETUP) id=gad->GadgetID;
  1071.    if(Schoner==TRUE) ScreenToFront(SchonerScreen);
  1072.    DeleteStdWindow(AbfrageWindow);
  1073.    ActivateWindow(WindowPtr);
  1074.    switch(id)
  1075.     {
  1076.      case 1:
  1077.      case 2:
  1078.        r=buffer;
  1079.       break;
  1080.      default:
  1081.        if(bool==FALSE) r=aktuell; else r=NULL;
  1082.       break;
  1083.     }
  1084.   }
  1085.  SetMenuStrip(WindowPtr,&Menu1);
  1086.  SetWindowTitles(WindowPtr,Titel,TitelText);
  1087.  return(r);
  1088. }
  1089.  
  1090.  
  1091. /* Tastendruck an PC senden */
  1092. VOID Taste(AmigaCode,Qualifier)
  1093.  UBYTE AmigaCode;
  1094.  UWORD Qualifier;
  1095. {
  1096.  REGISTER UBYTE PCCode,s;
  1097.  
  1098.  if(SysTestWindow)
  1099.   {
  1100.    sprintf(Buffer,"Amiga-Taste <$%02lx> gedrückt.\n",AmigaCode);
  1101.    Write(SysTestWindow,Buffer,strlen(Buffer));
  1102.   }
  1103.  PCCode=TastenTabelle[AmigaCode];
  1104.  if((Qualifier & IEQUALIFIER_LCOMMAND)
  1105.      || (Qualifier & IEQUALIFIER_RCOMMAND)
  1106.      || (PCCode==0xFF))
  1107.   {
  1108.    if(Einstellungen.Tastenfilter) return;
  1109.   }
  1110.  if((PCCode & BIT7) && (!(Einstellungen.Tastenruecknahme))) return;
  1111.  if((Qualifier & IEQUALIFIER_REPEAT) && (!(Einstellungen.Tastenwiederholung))) return;
  1112.  switch(AmigaCode)
  1113.   {
  1114.    case 0xe0:
  1115.      kstatus.LShift=0;
  1116.     break;
  1117.    case 0x60:
  1118.      kstatus.LShift=1;
  1119.     break;
  1120.    case 0xe1:
  1121.      kstatus.RShift=0;
  1122.     break;
  1123.    case 0x61:
  1124.      kstatus.RShift=1;
  1125.     break;
  1126.    case 0xe4:
  1127.    case 0xe5:
  1128.      kstatus.Alt=0;
  1129.     break;
  1130.    case 0x64:
  1131.    case 0x65:
  1132.      kstatus.Alt=1;
  1133.     break;
  1134.    case 0xe3:
  1135.      kstatus.Ctrl=0;
  1136.     break;
  1137.    case 0x63:
  1138.      kstatus.Ctrl=1;
  1139.     break;
  1140.   }
  1141.  
  1142.  if(Einstellungen.ATStatus)
  1143.   {
  1144.    Disable();
  1145.    atstatus->Valid=0;
  1146.    s=0;
  1147.    if(Qualifier & IEQUALIFIER_CAPSLOCK) s+=STATUS_CAPS;
  1148.    if(kstatus.LShift) s+=STATUS_LSHIFT;
  1149.    if(kstatus.RShift) s+=STATUS_RSHIFT;
  1150.    if(kstatus.Alt) s+=STATUS_ALT;
  1151.    if(kstatus.Ctrl) s+=STATUS_CTRL;
  1152.    atstatus->Status=s;
  1153.    s=0;
  1154.    if(kstatus.Alt) s+=EXTSTATUS_ALT_DOWN;
  1155.    if(kstatus.Ctrl) s+=EXTSTATUS_CONTROL_DOWN;
  1156.    atstatus->ExtStatus=s;
  1157.    atstatus->Valid=0xFF;
  1158.    Enable();
  1159.   }
  1160.  else
  1161.    atstatus->Valid=0;
  1162.  
  1163.  switch(AmigaCode)
  1164.   {
  1165.    case 0x62:
  1166.    case 0x62|BIT7:
  1167.      Sendung(0xba);
  1168.      Delay(Einstellungen.Uebertragungsrate);
  1169.      if(Einstellungen.WarteAufInt) Wait(KeyboardSignalMask);
  1170.      Sendung(0x3a);
  1171.     break;
  1172.    default:
  1173.      if(SysTestWindow)
  1174.       {
  1175.        sprintf(Buffer,"   Übertragung als PC-Taste <$%02lx>.\n",PCCode);
  1176.        Write(SysTestWindow,Buffer,strlen(Buffer));
  1177.       }
  1178.      Sendung(PCCode);
  1179.      if(Einstellungen.WarteAufInt) Wait(KeyboardSignalMask);
  1180.     break;
  1181.    }
  1182.  Delay(Einstellungen.Uebertragungsrate);
  1183. }
  1184.  
  1185.  
  1186. /* Tastenkombination an PC senden */
  1187. VOID Tastenkombination(array)
  1188.  UBYTE *array;
  1189. {
  1190.  REGISTER WORD i;
  1191.  REGISTER UBYTE PCCode;
  1192.  
  1193.  if(SysTestWindow)
  1194.   {
  1195.    strcpy(Buffer,"Tastenkombination im Menü gewählt\n");
  1196.    Write(SysTestWindow,Buffer,strlen(Buffer));
  1197.   }
  1198.  for(i=0;i<array[0];i++)
  1199.   {
  1200.    PCCode=TastenTabelle[array[i+1]];
  1201.    if(SysTestWindow)
  1202.     {
  1203.      sprintf(Buffer,"   Übertragung Amiga-Taste <$%02lx> zu PC-Taste <$%02lx>.\n",array[i+1],PCCode);
  1204.      Write(SysTestWindow,Buffer,strlen(Buffer));
  1205.     }
  1206.    Sendung(PCCode);
  1207.    Delay(Einstellungen.Uebertragungsrate);
  1208.    if(Einstellungen.WarteAufInt) Wait(KeyboardSignalMask);
  1209.   }
  1210. }
  1211.  
  1212.  
  1213. /* Uhrzeit in Textform an PC senden */
  1214. UBYTE AsciiTab[]={'0','1','2','3','4','5','6','7','8','9',' ','.'};
  1215. UBYTE RawTab[]={0xA,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9,0x40,0x39};
  1216.  
  1217. VOID UhrzeitEinsetzen()
  1218. {
  1219.  REGISTER WORD i,j,k,l;
  1220.  UBYTE         TextBuffer[35];
  1221.  
  1222.  KopiereZeit();
  1223.  sprintf(Buffer,"%ld:%02ld:%02ld",PublicTime->Hours,
  1224.                                   PublicTime->Minutes,
  1225.                                   PublicTime->Seconds);
  1226.  j=strlen(Buffer);
  1227.  k=2;
  1228.  TextBuffer[1]=0x60|BIT7;
  1229.  for(i=0;i<j;i++)
  1230.   {
  1231.    switch(Buffer[i])
  1232.     {
  1233.      case ':':
  1234.        TextBuffer[k]=0x60;      k++;
  1235.        TextBuffer[k]=0x39;      k++;
  1236.        TextBuffer[k]=0x39|BIT7; k++;
  1237.        TextBuffer[k]=0x60|BIT7; k++;
  1238.       break;
  1239.      default:
  1240.        for(l=0;l<=11;l++)
  1241.         {
  1242.          if(AsciiTab[l]==Buffer[i])
  1243.           {
  1244.            TextBuffer[k]=RawTab[l];      k++;
  1245.            TextBuffer[k]=RawTab[l]|BIT7; k++;
  1246.           }
  1247.         }
  1248.       break;
  1249.     }
  1250.   }
  1251.  TextBuffer[0]=k-1;
  1252.  Tastenkombination(&TextBuffer);
  1253. }
  1254.  
  1255.  
  1256. /* Datum in Textform an PC senden */
  1257. VOID DatumEinsetzen()
  1258. {
  1259.  REGISTER WORD i,j,k,l;
  1260.  UBYTE         TextBuffer[35];
  1261.  
  1262.  KopiereZeit();
  1263.  sprintf(Buffer,"%ld. %ld. %ld",PublicTime->Day,
  1264.                                 PublicTime->Month,
  1265.                                 PublicTime->Year);
  1266.  j=strlen(Buffer);
  1267.  k=2;
  1268.  TextBuffer[1]=0x60|BIT7;
  1269.  for(i=0;i<j;i++)
  1270.   {
  1271.    for(l=0;l<=11;l++)
  1272.     {
  1273.      if(AsciiTab[l]==Buffer[i])
  1274.       {
  1275.        TextBuffer[k]=RawTab[l];      k++;
  1276.        TextBuffer[k]=RawTab[l]|BIT7; k++;
  1277.       }
  1278.     }
  1279.   }
  1280.  TextBuffer[0]=k-1;
  1281.  Tastenkombination(&TextBuffer);
  1282. }
  1283.  
  1284.  
  1285. /* PC-Code senden */
  1286. #asm
  1287.    public _Sendung
  1288. _Sendung:
  1289.    movem.l a1-a2/d7,-(sp)
  1290.    move.l 16(sp),d7
  1291.    move.l _JanusStart,a1
  1292.    move.l a1,a2
  1293.    adda.l #516096,a1
  1294.    moveq.l #0,d0
  1295.    move.l _JanusBase,a6
  1296.    move.w 114(a6),d0
  1297.    add.l d0,a1
  1298.    adda.l #524283,a2
  1299.    move.b d7,(a1)
  1300.    move.b #-1,(a2)
  1301.    movem.l (sp)+,a1-a2/d7
  1302.    rts
  1303.  
  1304.  ; Implementation von CacheControl
  1305.  ; (ab Kickstart 2.0)
  1306.    public _CacheControl
  1307. _CacheControl:
  1308.    move.l 4(sp),d0
  1309.    move.l 8(sp),d1
  1310.    move.l a6,-(sp)
  1311.    move.l $4,a6
  1312.    jsr -648(a6)
  1313.    move.l (sp)+,a6
  1314.    rts
  1315. #endasm
  1316.  
  1317.  
  1318. /* Online/Offline wählen */
  1319. VOID XLine(xline)
  1320.  BOOL xline;
  1321. {
  1322.  REGISTER BOOL bool;
  1323.  
  1324.  if(xline==TRUE)
  1325.   {
  1326.    if(Online==FALSE)
  1327.     {
  1328.      ClearMenuStrip(WindowPtr);
  1329.      Inaktiv(&Offline_Item);
  1330.      Aktiv(&Online_Item);
  1331.      SetMenuStrip(WindowPtr,&Menu1);
  1332.      SetWindowTitles(WindowPtr,OnlineText,TitelText);
  1333.      if(KeyboardInt==NULL)
  1334.       {
  1335.        KeyboardInt=SetupJanusSig(JSERV_ENBKB,KeyboardSignal,16,MEMF_PARAMETER|MEM_BYTEACCESS);
  1336.        if(KeyboardInt==NULL)
  1337.         {
  1338.          do
  1339.           {
  1340.            bool=Requester("Der Tastatur-Interrupt ist durch",
  1341.                           "ein anderes Programm belegt.","Weiter","Abbruch");
  1342.            if(bool==TRUE)
  1343.             {
  1344.              KeyboardInt=SetupJanusSig(JSERV_ENBKB,KeyboardSignal,16,MEMF_PARAMETER|MEM_BYTEACCESS);
  1345.             }
  1346.            else
  1347.             {
  1348.              CloseAll();
  1349.             }
  1350.           } while(KeyboardInt==NULL);
  1351.         }
  1352.        atstatus=KeyboardInt->ss_ParamPtr;
  1353.       }
  1354.      Online=TRUE;
  1355.     }
  1356.   }
  1357.  else
  1358.   {
  1359.    if(Online==TRUE)
  1360.     {
  1361.      ClearMenuStrip(WindowPtr);
  1362.      Inaktiv(&Online_Item);
  1363.      Aktiv(&Offline_Item);
  1364.      SetMenuStrip(WindowPtr,&Menu1);
  1365.      SetWindowTitles(WindowPtr,OfflineText,TitelText);
  1366.      if(Einstellungen.IntFreigabe)
  1367.       {
  1368.        CleanupJanusSig(KeyboardInt);
  1369.        KeyboardInt=NULL;
  1370.       }
  1371.      Online=FALSE;
  1372.     }
  1373.   }
  1374. }
  1375.  
  1376. /* Tastaturmodus ändern */
  1377. VOID NeuerModus(num,menue)
  1378.  WORD num;
  1379.  BOOL menue;
  1380. {
  1381.  REGISTER WORD i;
  1382.  
  1383.  if((num>=0)&&(num<=7))
  1384.   {
  1385.    if(menue==TRUE) ClearMenuStrip(WindowPtr);
  1386.    for(i=0;i<=7;i++)
  1387.     {
  1388.      Inaktiv(&TM_Item[i]);
  1389.     }
  1390.    Aktiv(&TM_Item[num]);
  1391.    SetzeTM(num);
  1392.    if(menue==TRUE) SetMenuStrip(WindowPtr,&Menu1);
  1393.   }
  1394. }
  1395.  
  1396.  
  1397. /* Alte Messages entfernen */
  1398. VOID LeerePort(p)
  1399.  struct MsgPort *p;
  1400. {
  1401.  NewList(&p->mp_MsgList);
  1402. }
  1403.  
  1404.  
  1405. /* Alte IDCMP-Messages entfernen */
  1406. VOID LeereIDCMP(win)
  1407.  struct Window *win;
  1408. {
  1409.  register struct IntuiMessage *IMessage;
  1410.  
  1411.  IMessage=GetMsg(win->UserPort);
  1412.  if(IMessage!=NULL)
  1413.   {
  1414.    do
  1415.     {
  1416.      ReplyMsg(IMessage);
  1417.      IMessage=GetMsg(win->UserPort);
  1418.     } while(IMessage!=NULL);
  1419.   }
  1420. }
  1421.  
  1422.  
  1423. /* Prüfen, ob TimeService ein- oder ausgeschaltet werden muß */
  1424. VOID KontrolliereService()
  1425. {
  1426.  REGISTER UBYTE *Titel;
  1427.  REGISTER LONG   i;
  1428.  
  1429.  if((Service==TRUE)&&(TimeService==NULL))
  1430.   {
  1431.    Titel=WindowPtr->Title;
  1432.    SetWindowTitles(WindowPtr,"Installiere TimeService... Bitte warten. ",TitelText);
  1433.    Say("starting the time service");
  1434.    SHelp->A=NULL;
  1435.    i=AddService(SHelp,TIMESERV_APPID,TIMESERV_LOCID,
  1436.                 sizeof(struct TimeServReq),MEMF_BUFFER,ServiceSignal,
  1437.                 ADDS_TOPC_ONLY);
  1438.    if(i!=JSERV_OK)
  1439.     {
  1440.      Service=FALSE;
  1441.      TimeService=NULL;
  1442.      ClearMenuStrip(WindowPtr);
  1443.      Inaktiv(&TimeService_Item);
  1444.      SetMenuStrip(WindowPtr,&Menu1);
  1445.      Requester("Der TimeService konnte nicht","installiert werden.","Okay",NULL);
  1446.     }
  1447.    else
  1448.     {
  1449.      TimeService=SHelp->A;
  1450.      TimeService=MakeWordPtr(TimeService);
  1451.      TimeReq=JanusOffsetToMem(TimeService->MemOffset,MEMF_BUFFER);
  1452.     }
  1453.    LeereIDCMP(WindowPtr);
  1454.    SetWindowTitles(WindowPtr,Titel,TitelText);
  1455.   }
  1456.  if((Service==FALSE)&&(TimeService!=NULL))
  1457.   {
  1458.    Say("removing the time service");
  1459.    DeleteService(TimeService);
  1460.    TimeService=NULL;
  1461.   }
  1462. }
  1463.  
  1464.  
  1465. /* Prüfen, ob Uhr ein- oder ausgeschaltet werden muß */
  1466. VOID KontrolliereUhr()
  1467. {
  1468.  if(Clock==TRUE)
  1469.   {
  1470.    if(Uhr==FALSE)
  1471.     {
  1472.      if(WindowPtr->Height==WindowDef.Height)
  1473.       {
  1474.        if(WindowPtr->TopEdge>=(WindowPtr->WScreen->Height-25))
  1475.         {
  1476.          MoveWindow(WindowPtr,0,-25);
  1477.         }
  1478.        SizeWindow(WindowPtr,0,20);
  1479.       }
  1480.      Uhr=TRUE;
  1481.      Say("clock turned on");
  1482.      if(!(WindowPtr->Flags & ZOOMED)) WindowPtr->Flags += ZOOMED;
  1483.     }
  1484.   }
  1485.  else
  1486.   {
  1487.    if(Uhr==TRUE)
  1488.     {
  1489.      if(WindowPtr->Height==ZoomArray[3]) SizeWindow(WindowPtr,0,-20);
  1490.      Uhr=FALSE;
  1491.      Say("clock turned off");
  1492.      if(WindowPtr->Flags & ZOOMED) WindowPtr->Flags -= ZOOMED;
  1493.     }
  1494.   }
  1495. }
  1496.  
  1497.  
  1498. /* Teste, ob FPU ein- oder ausgeschaltet werden muß */
  1499. VOID KontrolliereFPU()
  1500. {
  1501.  if(Schoner==FALSE)
  1502.   {
  1503.    if(M68881_Item.Flags & ITEMENABLED)
  1504.     {
  1505.      if(M68881_Item.Flags & CHECKED) FPU=1; else FPU=0;
  1506.     }
  1507.    else
  1508.     {
  1509.      FPU=0;
  1510.     }
  1511.   }
  1512. }
  1513.  
  1514. VOID KontrolliereCPU()
  1515. {
  1516.  if(SysBase->AttnFlags & AFF_68030)
  1517.   {
  1518.    if(KickstartVersion>=36)
  1519.     {
  1520.      if(Einstellungen.DataCache)
  1521.       {
  1522.        CacheControl(CACRF_EnableD,CACRF_EnableD|CACRF_FreezeD);
  1523.       }
  1524.      else
  1525.       {
  1526.        CacheControl(CACRF_FreezeD,CACRF_EnableD|CACRF_FreezeD);
  1527.       }
  1528.     }
  1529.   }
  1530.  if(SysBase->AttnFlags & AFF_68030)
  1531.   {
  1532.    if(Einstellungen.DataCache) CPU=1; else CPU=0;
  1533.   }
  1534. }
  1535.  
  1536. /* Zeit in öffentlichen Bereich kopieren */
  1537. VOID KopiereZeit()
  1538. {
  1539.  Forbid();
  1540.  CopyMem(SystemTime,PublicTime,sizeof(struct SystemTime));
  1541.  Permit();
  1542. }
  1543.  
  1544.  
  1545. /* Timer-Task erstellen */
  1546. UBYTE *TimerTaskName="ATKeyboard Timer Task by Thomas Dreibholz";
  1547.  
  1548. BOOL ErstelleTimerTask()
  1549. {
  1550.  SubTask=CreateProcess(TimerTask,1500,TimerTaskName,0);
  1551.  if(SubTask!=NULL) return(TRUE); else return(FALSE);
  1552. }
  1553.  
  1554.  
  1555. /* Task zur Steuerung der Uhr */
  1556. ULONG TageProMonat[]={00,31,28,31,
  1557.                       30,31,30,31,
  1558.                       31,30,31,30,
  1559.                       31};
  1560.  
  1561. VOID TimerTask()
  1562. {
  1563.  REGISTER ULONG           Tage,Jahr,Monat;
  1564.  register struct Message *msg;
  1565.  
  1566.  geta4();
  1567.  SystemTime->OldDays=0x0FFFFFFF;
  1568.  msg=NULL;
  1569.  do
  1570.   {
  1571.    DateStamp(SystemTime);
  1572.    Forbid();
  1573.    Tage=SystemTime->DateStamp.ds_Days;
  1574.    SystemTime->Hours=DivU32(SystemTime->DateStamp.ds_Minute,60);
  1575.    SystemTime->Minutes=SystemTime->DateStamp.ds_Minute%60;
  1576.    SystemTime->Seconds=DivU32(SystemTime->DateStamp.ds_Tick,TICKS_PER_SECOND);
  1577.    SystemTime->DayNum=Tage%7;
  1578.    if(Tage!=SystemTime->OldDays)
  1579.     {
  1580.      SystemTime->OldDays=Tage;
  1581.      Jahr=1978;
  1582.      while(Tage>365)
  1583.       {
  1584.        if((Jahr%4)==0) Tage-=366; else Tage-=365;
  1585.        Jahr++;
  1586.       }
  1587.      if((Tage==365) && !((Jahr%4)==0)) Tage-=365;
  1588.      if((Jahr%4)==0) TageProMonat[2]=29; else TageProMonat[2]=28;
  1589.      Monat=1;
  1590.      while(Tage>=TageProMonat[Monat])
  1591.       {
  1592.        Tage-=TageProMonat[Monat];
  1593.        Monat++;
  1594.       }
  1595.      Tage++;
  1596.      SystemTime->Year=Jahr;
  1597.      SystemTime->Month=Monat;
  1598.      SystemTime->Day=Tage;
  1599.     }
  1600.    Permit();
  1601.    Signal(MainTask,TimerTaskSignalMask);
  1602.    Delay(40);
  1603.    msg=GetMsg(Port4);
  1604.   } while(msg==NULL);
  1605.  ReplyMsg(msg);
  1606.  Exit(0);
  1607. }
  1608.  
  1609.  
  1610. /* Menüpunkt abhaken */
  1611. VOID Aktiv(item)
  1612.  struct MenuItem *item;
  1613. {
  1614.  item->Flags |= CHECKED;
  1615. }
  1616.  
  1617.  
  1618. /* Menühaken entfernen */
  1619. VOID Inaktiv(item)
  1620.  struct MenuItem *item;
  1621. {
  1622.  item->Flags &= xCHECKED;
  1623. }
  1624.  
  1625.  
  1626. /* Informationen zum Programm */
  1627. VOID ShowInformation(aktiv)
  1628.  BOOL aktiv;
  1629. {
  1630.  REGISTER UBYTE *Titel;
  1631.  
  1632.  Titel=WindowPtr->Title;
  1633.  SetWindowTitles(WindowPtr,TitelText,TitelText);
  1634.  ExtInformationBox(NULL,"ATKeyboard - Information",
  1635.                    Copyright[0],Copyright[1],
  1636.                    Copyright[2],Copyright[3],
  1637.                    ATName,&idata);
  1638.  if(aktiv==TRUE) ActivateWindow(WindowPtr);
  1639.  SetWindowTitles(WindowPtr,Titel,TitelText);
  1640. }
  1641.  
  1642.  
  1643. /* Tastaturtabelle laden */
  1644. VOID LadeTabelle(num)
  1645.  UWORD num;
  1646. {
  1647.  register struct FileHandle *fh;
  1648.  REGISTER UWORD              i;
  1649.  
  1650.  fh=Open(TabellenDatei,MODE_OLDFILE);
  1651.  if(fh!=NULL)
  1652.   {
  1653.    i=Read(fh,KeyCodes,sizeof(struct KeyCodes));
  1654.    if(i==sizeof(struct KeyCodes))
  1655.     {
  1656.      KeyCodes->KeyTab[0].Valid=1;
  1657.      if(KeyCodes->KeyTab[num].Valid==0) num=0;
  1658.      for(i=0;i<256;i++)
  1659.       {
  1660.        TastenTabelle[i]=KeyCodes->KeyTab[num].Keys[i];
  1661.       }
  1662.      for(i=0;i<=7;i++)
  1663.       {
  1664.        TM_Text[i].IText=&KeyCodes->KeyTab[i].Name;
  1665.        if(!(KeyCodes->KeyTab[i].Valid)) TM_Item[i].Flags &= xITEMENABLED;
  1666.       }
  1667.      Aktiv(&TM_Item[num]);
  1668.      Einstellungen.Tastaturmodus=num;
  1669.     }
  1670.    else
  1671.     {
  1672.      Fehlerbehandlung(TRUE,"ATKeyboard - Inkompatible T-Datei");
  1673.     }
  1674.    Close(fh);
  1675.   }
  1676.  else
  1677.   {
  1678.    Fehlerbehandlung(TRUE,"ATKeyboard - Keine Tabellendatei");
  1679.   }
  1680. }
  1681.  
  1682.  
  1683. /* Einstellungen laden */
  1684. VOID LadeEinstellungen(tab)
  1685.  BOOL tab;
  1686. {
  1687.  struct FileHandle *fh;
  1688.  
  1689.  fh=Open(EinstellungsDatei,MODE_OLDFILE);
  1690.  if(fh!=NULL)
  1691.   {
  1692.    Read(fh,&Einstellungen,sizeof(struct Einstellungen));
  1693.    Close(fh);
  1694.   }
  1695.  if(tab==TRUE)
  1696.   {
  1697.    fh=Open(TabellenDatei,MODE_OLDFILE);
  1698.    if(fh!=NULL)
  1699.     {
  1700.      Read(fh,KeyCodes,sizeof(struct KeyCodes));
  1701.      Close(fh);
  1702.     }
  1703.   }
  1704.  ARexxName=&Einstellungen.ARexxName;
  1705. }
  1706.  
  1707.  
  1708. /* Einstellungen sichern */
  1709. VOID SichereEinstellungen()
  1710. {
  1711.  struct FileHandle *fh;
  1712.  
  1713.  strcpy(&Einstellungen.ARexxName,ARexxName);
  1714.  fh=Open(EinstellungsDatei,MODE_NEWFILE);
  1715.  if(fh!=NULL)
  1716.   {
  1717.    Write(fh,&Einstellungen,sizeof(struct Einstellungen));
  1718.    Close(fh);
  1719.   }
  1720.  fh=Open(TabellenDatei,MODE_NEWFILE);
  1721.  if(fh!=NULL)
  1722.   {
  1723.    Write(fh,KeyCodes,sizeof(struct KeyCodes));
  1724.    Close(fh);
  1725.   }
  1726. }
  1727.  
  1728.  
  1729. /* Einstellungen sicherbar machen */
  1730. VOID ZeigeEinstellungen(menue)
  1731.  BOOL menue;
  1732. {
  1733.  REGISTER WORD i;
  1734.  
  1735.  if(menue==TRUE) ClearMenuStrip(WindowPtr);
  1736.  NeuerModus(Einstellungen.Tastaturmodus,FALSE);
  1737.  if(Einstellungen.Kontrollfenster)
  1738.    Aktiv(&Kontrollfenster_Item); else Inaktiv(&Kontrollfenster_Item);
  1739.  if(Einstellungen.Tastenfilter)
  1740.    Aktiv(&Tastenfilter_Item); else Inaktiv(&Tastenfilter_Item);
  1741.  if(Einstellungen.ATStatus)
  1742.    Aktiv(&Status_Item); else Inaktiv(&Status_Item);
  1743.  if(Einstellungen.Tastenruecknahme)
  1744.    Aktiv(&Tastenruecknahme_Item); else Inaktiv(&Tastenruecknahme_Item);
  1745.  if(Einstellungen.Tastenwiederholung)
  1746.    Aktiv(&Tastenwiederholung_Item); else Inaktiv(&Tastenwiederholung_Item);
  1747.  if(Einstellungen.WarteAufInt)
  1748.    Aktiv(&WarteAufInt_Item); else Inaktiv(&WarteAufInt_Item);
  1749.  if(Einstellungen.Bildschirmschoner)
  1750.    Aktiv(&Bildschirmschoner_Item); else Inaktiv(&Bildschirmschoner_Item);
  1751.  if(Einstellungen.AutoStart)
  1752.    Aktiv(&AutoStart_Item); else Inaktiv(&AutoStart_Item);
  1753.  if(Einstellungen.LPT1Verwaltung)
  1754.    Aktiv(&LPT1_Item); else Inaktiv(&LPT1_Item);
  1755.  if(Einstellungen.TimeService)
  1756.    Aktiv(&TimeService_Item); else Inaktiv(&TimeService_Item);
  1757.  if(Einstellungen.Speak)
  1758.    Aktiv(&Speak_Item); else Inaktiv(&Speak_Item);
  1759.  if(Einstellungen.Uhr)
  1760.    Aktiv(&Uhr_Item); else Inaktiv(&Uhr_Item);
  1761.  if(Einstellungen.IntFreigabe)
  1762.    Aktiv(&IntFreigabe_Item); else Inaktiv(&IntFreigabe_Item);
  1763.  for(i=0;i<=15;i++)
  1764.   {
  1765.    if(Einstellungen.Gfx[i]) Aktiv(&Gfx_Item[i]); else Inaktiv(&Gfx_Item[i]);
  1766.   }
  1767.  if(Einstellungen.SystemPAL)
  1768.    Aktiv(&PAL_Item); else Inaktiv(&PAL_Item);
  1769.  if(Einstellungen.Maus)
  1770.    Aktiv(&Maus_Item); else Inaktiv(&Maus_Item);
  1771.  if(Einstellungen.A2286)
  1772.   {
  1773.    Setup_Item.Flags |= ITEMENABLED;
  1774.    Aktiv(&A2286_Item);
  1775.   }
  1776.  else
  1777.   {
  1778.    Setup_Item.Flags &= xITEMENABLED;
  1779.    Inaktiv(&A2286_Item);
  1780.   }
  1781.  if(Einstellungen.M68881)
  1782.    Aktiv(&M68881_Item); else Inaktiv(&M68881_Item);
  1783.  if(Einstellungen.M68020)
  1784.    Aktiv(&M68020_Item); else Inaktiv(&M68020_Item);
  1785.  if(Einstellungen.DataCache)
  1786.    Aktiv(&DataCache_Item); else Inaktiv(&DataCache_Item);
  1787.  if(Einstellungen.SichernBeiEnde)
  1788.    Aktiv(&SichernBeiEnde_Item); else Inaktiv(&SichernBeiEnde_Item);
  1789.  if(Einstellungen.ARexxIO)
  1790.    Aktiv(&ARexxIO_Item); else Inaktiv(&ARexxIO_Item);
  1791.  if(Einstellungen.LED)
  1792.    Aktiv(&DSWarnung_Item); else Inaktiv(&DSWarnung_Item);
  1793.  switch(Einstellungen.Umlenkung)
  1794.   {
  1795.    case 0:
  1796.      Inaktiv(&ZuDatei_Item); Aktiv(&ParPort_Item); Inaktiv(&PrtPort_Item);
  1797.     break;
  1798.    case 1:
  1799.      Inaktiv(&ZuDatei_Item); Inaktiv(&ParPort_Item); Aktiv(&PrtPort_Item);
  1800.     break;
  1801.    case 2:
  1802.      Aktiv(&ZuDatei_Item); Inaktiv(&ParPort_Item); Inaktiv(&PrtPort_Item);
  1803.     break;
  1804.   }
  1805.  Aktiv(&TM_Item[0]);
  1806.  for(i=0;i<=7;i++) Inaktiv(&TM_Item[i]);
  1807.  if(Einstellungen.TastaturmodusSichern)
  1808.   {
  1809.    Aktiv(&TModusSichern_Item);
  1810.    if((Einstellungen.Tastaturmodus>=0)&&(Einstellungen.Tastaturmodus<=7))
  1811.     {
  1812.      Inaktiv(&TM_Item[0]);
  1813.      Aktiv(&TM_Item[Einstellungen.Tastaturmodus]);
  1814.      SetzeTM(Einstellungen.Tastaturmodus);
  1815.     }
  1816.    else
  1817.     {
  1818.      Einstellungen.Tastaturmodus=0;
  1819.     }
  1820.   }
  1821.  else Inaktiv(&TModusSichern_Item);
  1822.  if(menue==TRUE) SetMenuStrip(WindowPtr,&Menu1);
  1823.  if(Einstellungen.Uhr) Clock=TRUE; else Clock=FALSE;
  1824.  if(Einstellungen.TimeService) Service=TRUE; else Service=FALSE;
  1825.  if(Einstellungen.LPT1Verwaltung) LPT1=TRUE; else LPT1=FALSE;
  1826.  if(Einstellungen.Speak) Speak=TRUE; else Speak=FALSE;
  1827.  KontrolliereUhr();
  1828.  if(menue==TRUE)
  1829.   {
  1830.    KontrolliereService();
  1831.    KontrolliereLPT1();
  1832.    KontrolliereFPU();
  1833.    KontrolliereCPU();
  1834.   }
  1835. }
  1836.  
  1837.  
  1838. /* Einstellungen ändern */
  1839. VOID EinstellungenAendern()
  1840. {
  1841.  REGISTER WORD i;
  1842.  
  1843.  if(Tastenfilter_Item.Flags & CHECKED)
  1844.    Einstellungen.Tastenfilter=YES; else Einstellungen.Tastenfilter=NO;
  1845.  if(Status_Item.Flags & CHECKED)
  1846.    Einstellungen.ATStatus=YES; else Einstellungen.ATStatus=NO;
  1847.  if(Tastenruecknahme_Item.Flags & CHECKED)
  1848.    Einstellungen.Tastenruecknahme=YES; else Einstellungen.Tastenruecknahme=NO;
  1849.  if(Tastenwiederholung_Item.Flags & CHECKED)
  1850.    Einstellungen.Tastenwiederholung=YES; else Einstellungen.Tastenwiederholung=NO;
  1851.  if(WarteAufInt_Item.Flags & CHECKED)
  1852.    Einstellungen.WarteAufInt=YES; else Einstellungen.WarteAufInt=NO;
  1853.  if(Bildschirmschoner_Item.Flags & CHECKED)
  1854.    Einstellungen.Bildschirmschoner=YES; else Einstellungen.Bildschirmschoner=NO;
  1855.  if(AutoStart_Item.Flags & CHECKED)
  1856.    Einstellungen.AutoStart=YES; else Einstellungen.AutoStart=NO;
  1857.  if(LPT1_Item.Flags & CHECKED)
  1858.    Einstellungen.LPT1Verwaltung=YES; else Einstellungen.LPT1Verwaltung=NO;
  1859.  if(TimeService_Item.Flags & CHECKED)
  1860.    Einstellungen.TimeService=YES; else Einstellungen.TimeService=NO;
  1861.  if(Uhr_Item.Flags & CHECKED)
  1862.    Einstellungen.Uhr=YES; else Einstellungen.Uhr=NO;
  1863.  if(IntFreigabe_Item.Flags & CHECKED)
  1864.    Einstellungen.IntFreigabe=YES; else Einstellungen.IntFreigabe=NO;
  1865.  if(A2286_Item.Flags & CHECKED)
  1866.    Einstellungen.A2286=YES; else Einstellungen.A2286=NO;
  1867.  if(M68881_Item.Flags & CHECKED)
  1868.    Einstellungen.M68881=YES; else Einstellungen.M68881=NO;
  1869.  if(M68020_Item.Flags & CHECKED)
  1870.    Einstellungen.M68020=YES; else Einstellungen.M68020=NO;
  1871.  if(DataCache_Item.Flags & CHECKED)
  1872.    Einstellungen.DataCache=YES; else Einstellungen.DataCache=NO;
  1873.  if(SichernBeiEnde_Item.Flags & CHECKED)
  1874.    Einstellungen.SichernBeiEnde=YES; else Einstellungen.SichernBeiEnde=NO;
  1875.  if(ARexxIO_Item.Flags & CHECKED)
  1876.    Einstellungen.ARexxIO=YES; else Einstellungen.ARexxIO=NO;
  1877.  if(TModusSichern_Item.Flags & CHECKED)
  1878.    Einstellungen.TastaturmodusSichern=YES; else Einstellungen.TastaturmodusSichern=NO;
  1879.  if(Speak_Item.Flags & CHECKED)
  1880.    Einstellungen.Speak=YES; else Einstellungen.Speak=NO;
  1881.  for(i=0;i<=15;i++)
  1882.   {
  1883.    if(Gfx_Item[i].Flags & CHECKED)
  1884.      Einstellungen.Gfx[i]=YES; else Einstellungen.Gfx[i]=NO;
  1885.   }
  1886.  if(Maus_Item.Flags & CHECKED)
  1887.    Einstellungen.Maus=YES; else Einstellungen.Maus=NO;
  1888.  if(PAL_Item.Flags & CHECKED)
  1889.    Einstellungen.SystemPAL=YES; else Einstellungen.SystemPAL=NO;
  1890.  if(DSWarnung_Item.Flags & CHECKED)
  1891.    Einstellungen.LED=YES; else Einstellungen.LED=NO;
  1892. }
  1893.  
  1894.  
  1895. /* System installieren */
  1896. VOID OpenAll()
  1897. {
  1898.  register struct Screen     *scr;
  1899.  register struct ConfigDev  *card;
  1900.  register struct FileHandle *fh;
  1901.  REGISTER BOOL               bool;
  1902.  REGISTER LONG               num;
  1903.  
  1904.  /* ----- Variablen installieren --------------------------------------- */
  1905.  KickstartVersion=SysBase->lib_Node.lib_Version;
  1906.  if(KickstartVersion<36) Menu7.Flags &= xMENUENABLED;
  1907.  MainTask=FindTask(NULL);
  1908.  Uhr=FALSE;
  1909.  SystemOK=FALSE;
  1910.  Schoner=FALSE;
  1911.  Service=FALSE;
  1912.  Clock=FALSE;
  1913.  ARexx=FALSE;
  1914.  LPT1=FALSE;
  1915.  Speak=FALSE;
  1916.  FPU=0;
  1917.  CPU=0;
  1918.  ARexxLock=0;
  1919.  ARexxMenuLock=0;
  1920.  
  1921.  /* ----- Libraries öffnen --------------------------------------------- */
  1922.  IntuitionBase=OpenLibrary("intuition.library",0L);
  1923.  GfxBase=OpenLibrary("graphics.library",0L);
  1924.  if((IntuitionBase==NULL)||(GfxBase==NULL)) CloseAll();
  1925.  
  1926.  /* ----- AutoStart ausführen ------------------------------------------ */
  1927.  NIL=Open("NIL:",MODE_NEWFILE);
  1928.  if(NIL==NULL)
  1929.   {
  1930.    printf("FEHLER: Kann NIL: nicht als Ausgabegerät öffnen!\n");
  1931.    CloseAll();
  1932.   }
  1933.  
  1934.  LadeEinstellungen(FALSE);
  1935.  if(Einstellungen.AutoStart)
  1936.   {
  1937.    KontrolliereCPU();
  1938.    Execute(AutoStartCmd,NULL,NIL);
  1939.   }
  1940.  
  1941.  /* ----- Fenster öffnen ----------------------------------------------- */
  1942.  scr=OpenWorkBench();
  1943.  WindowDef.Height=scr->WBorTop+scr->Font->ta_YSize+1;
  1944.  ZoomArray[3]=WindowDef.Height+20;
  1945.  WindowPtr=OpenWindow(&WindowDef);
  1946.  if(WindowPtr==NULL)
  1947.   {
  1948.    printf("FEHLER: Kann Fenster nicht öffnen!\n");
  1949.    CloseAll();
  1950.   }
  1951.  RastPortPtr=WindowPtr->RPort;
  1952.  
  1953.  /* ----- ATUtilities -------------------------------------------------- */
  1954.  
  1955.  ATUtilitiesBase=OpenLibrary("at-utilities.library",0);
  1956.  if(ATUtilitiesBase==NULL)
  1957.   {
  1958.    Fehlerbehandlung(TRUE,"ATKeyboard - Keine ATUtilities-Library");
  1959.   }
  1960.  Erweiterungen_Item.SubItem=CreateUtilityList();
  1961.  
  1962.  /* ----- Opal/9-Font und Times/24-Font laden -------------------------- */
  1963.  DiskfontBase=OpenLibrary("diskfont.library",0L);
  1964.  if(DiskfontBase==NULL) Fehlerbehandlung(TRUE,"ATKeyboard - Keine Diskfont-Library");
  1965.  OpalFont=OpenDiskFont(&OpalFontDef);
  1966.  if(OpalFont==NULL) Fehlerbehandlung(TRUE,"ATKeyboard - Kann Opal-Font nicht laden");
  1967.  SchonerFont=OpenDiskFont(&TimesFontDef);
  1968.  SetFont(RastPortPtr,OpalFont);
  1969.  
  1970.  /* ----- Weitere Libraries öffnen und testen, ob PC-Karte vorhanden --- */
  1971.  ExpansionBase=OpenLibrary("expansion.library",0L);
  1972.  if(ExpansionBase!=NULL)
  1973.   {
  1974.    card=FindConfigDev(NULL,513,-1);
  1975.   }
  1976.  if(card==NULL) Fehlerbehandlung(TRUE,"ATKeyboard - Keine PC/AT-Karte gefunden");
  1977.  
  1978.  IconBase=OpenLibrary("icon.library",0L);
  1979.  if(IconBase==NULL) Fehlerbehandlung(TRUE,"ATKeyboard - Keine Icon-Library");
  1980.  
  1981.  if(ATName==NULL)
  1982.   {
  1983.    ATName=WBenchMsg->sm_ArgList->wa_Name;
  1984.   }
  1985.  UtilityBase=OpenLibrary("utility.library",0L);
  1986.  AslBase=OpenLibrary("asl.library",0L);
  1987.  if((UtilityBase!=NULL)&&(AslBase!=NULL))
  1988.   {
  1989.    FRTags=AllocateTagItems(6L);
  1990.    if(FRTags!=NULL)
  1991.     {
  1992.      FRTags[0].ti_Tag=ASL_Pattern;
  1993.      FRTags[0].ti_Data=NULL;
  1994.      FRTags[1].ti_Tag=ASL_FuncFlags;
  1995.      FRTags[1].ti_Data=FILF_PATGAD;
  1996.      FRTags[2].ti_Tag=ASL_Hail;
  1997.      FRTags[2].ti_Data=NULL;
  1998.      FRTags[3].ti_Tag=TAG_DONE;
  1999.      FRTags[4].ti_Tag=TAG_DONE;
  2000.      FRTags[5].ti_Tag=TAG_DONE;
  2001.      FileRequester=AllocFileRequest();
  2002.     }
  2003.   }
  2004.  
  2005.  /* ----- Mathematische Libraries öffnen ------------------------------- */
  2006.  MathBase=OpenLibrary("mathffp.library",0L);
  2007.  MathTransBase=OpenLibrary("mathtrans.library",0L);
  2008.  if((MathBase==NULL)||(MathTransBase==NULL))
  2009.   {
  2010.    Fehlerbehandlung(TRUE,"ATKeyboard - Keine MathTrans-Library");
  2011.   }
  2012.  
  2013.  /* ----- Translator-Library öffnen ------------------------------------ */
  2014.  
  2015.  TranslatorBase=OpenLibrary("translator.library",0L);
  2016.  if(TranslatorBase==NULL)
  2017.   {
  2018.    Fehlerbehandlung(TRUE,"ATKeyboard - Keine Translator-Library");
  2019.   }
  2020.  
  2021.  /* ----- Message-Ports erstellen -------------------------------------- */
  2022.  Port1=CreatePort("ATKeyboard Schoner Task <Stop>",0L);
  2023.  Port2=CreatePort("ATKeyboard Color Cycling Task <Stop>",0L);
  2024.  Port3=CreatePort("ATKeyboard Stop Reply Port",0L);
  2025.  Port4=CreatePort("ATKeyboard Timer Task <Stop>",0L);
  2026.  Port5=CreatePort("ATKeyboard Printer Task <Stop>",0L);
  2027.  ParallelPort=CreatePort("ATKeyboard Parallel Device Transfer Port",0L);
  2028.  if( (Port1==NULL) || (Port2==NULL) ||
  2029.      (Port3==NULL) || (Port4==NULL) ||
  2030.      (Port5==NULL) || (ParallelPort==NULL) )
  2031.   {
  2032.    Fehlerbehandlung(TRUE,"ATKeyboard - Kann Ports nicht erstellen");
  2033.   }
  2034.  
  2035.  ParallelRequest=CreateExtIO(ParallelPort,sizeof(struct IOExtPar));
  2036.  if(ParallelRequest==NULL)
  2037.   {
  2038.    Fehlerbehandlung(TRUE,"ATKeyboard - Kann IOExtPar nicht erstellen");
  2039.   }
  2040.  
  2041.  /* ----- Janus-Library öffnen ----------------------------------------- */
  2042.  JanusBase=OpenLibrary("janus.library",0L);
  2043.  if(JanusBase==NULL)
  2044.   {
  2045.    Fehlerbehandlung(TRUE,"ATKeyboard - Janus-Library nicht gefunden");
  2046.   }
  2047.  JanusStart=GetJanusStart();
  2048.  
  2049.  /* ----- Signale belegen ---------------------------------------------- */
  2050.  KeyboardSignal=AllocSignal(-1L);
  2051.  ServiceSignal=AllocSignal(-1L);
  2052.  TimerTaskSignal=AllocSignal(-1L);
  2053.  if((KeyboardSignal==-1)||(ServiceSignal==-1)||(TimerTaskSignal==-1))
  2054.   {
  2055.    Fehlerbehandlung(TRUE,"ATKeyboard - Keine freien Task-Signale");
  2056.   }
  2057.  IntuitionSignal=WindowPtr->UserPort->mp_SigBit;
  2058.  KeyboardSignalMask=(1L<<KeyboardSignal);
  2059.  ServiceSignalMask=(1L<<ServiceSignal);
  2060.  TimerTaskSignalMask=(1L<<TimerTaskSignal);
  2061.  IntuitionSignalMask=(1L<<IntuitionSignal);
  2062.  WaitSignalMask=KeyboardSignalMask+
  2063.                 ServiceSignalMask+
  2064.                 TimerTaskSignalMask+
  2065.                 IntuitionSignalMask;
  2066.  
  2067.  /* ----- Einstellungen von Diskette laden ----------------------------- */
  2068.  KeyCodes=AllocMem(sizeof(struct KeyCodes),MEMF_CLEAR|MEMF_PUBLIC);
  2069.  if(KeyCodes==NULL) Fehlerbehandlung(TRUE,"ATKeyboard - Nicht genug Speicher");
  2070.  if(Einstellungen.TastaturmodusSichern)
  2071.   {
  2072.    num=Einstellungen.Tastaturmodus;
  2073.    if(!((num>=0)&&(num<=7))) num=0;
  2074.    LadeTabelle(num);
  2075.   }
  2076.  else
  2077.   {
  2078.    LadeTabelle(0);
  2079.   }
  2080.  SetTaskPri(MainTask,Einstellungen.Prioritaet);
  2081.  if(Einstellungen.Bildschirmschoner) Schoner=TRUE;
  2082.  if(Einstellungen.TimeService) Service=TRUE;
  2083.  if(Einstellungen.Uhr) Clock=TRUE;
  2084.  if(Einstellungen.LPT1Verwaltung) LPT1=TRUE;
  2085.  LiesATP();
  2086.  
  2087.  /* ----- Prüfen, ob Coprozessor vorhanden ----------------------------- */
  2088.  bool=FALSE;
  2089.  if(SysBase->AttnFlags & AFF_68881) bool=TRUE;
  2090.  if(SysBase->AttnFlags & AFF_68882) bool=TRUE;
  2091.  if(bool) M68881_Item.Flags |= ITEMENABLED;
  2092.  KontrolliereFPU();
  2093.  
  2094.  /* ----- Prüfen, ob 68020/68030 vorhanden ----------------------------- */
  2095.  if((SysBase->AttnFlags & AFF_68030)&&(KickstartVersion>=36))
  2096.   {
  2097.    DataCache_Item.Flags |= ITEMENABLED;
  2098.   }
  2099.  KontrolliereCPU();
  2100.  if(SysBase->AttnFlags & AFF_68020)
  2101.   {
  2102.    M68020_Item.Flags |= ITEMENABLED;
  2103.   }
  2104.  
  2105.  /* ----- Einstellugen im Menü abhaken und Menü-Strip darstellen ------- */
  2106.  ZeigeEinstellungen(FALSE);
  2107.  
  2108.  /* ----- Tastatur-Interrupt belegen ----------------------------------- */
  2109.  KeyboardInt=SetupJanusSig(JSERV_ENBKB,KeyboardSignal,16,MEMF_PARAMETER|MEM_BYTEACCESS);
  2110.  if(KeyboardInt==NULL)
  2111.   {
  2112.    Fehlerbehandlung(TRUE,"ATKeyboard - Janus-Interrupt ist belegt");
  2113.   }
  2114.  atstatus=KeyboardInt->ss_ParamPtr;
  2115.  
  2116.  /* ----- Speicher belegen --------------------------------------------- */
  2117.  SystemTime=AllocMem(MEMSIZE,MEMF_CLEAR|MEMF_PUBLIC);
  2118.  Chip=AllocMem(16,MEMF_CLEAR|MEMF_PUBLIC|MEMF_CHIP);
  2119.  if((SystemTime==NULL)||(Chip==NULL))
  2120.   {
  2121.    Fehlerbehandlung(TRUE,"ATKeyboard - Nicht genug Speicher");
  2122.   }
  2123.  PublicTime=((ULONG)SystemTime+(ULONG)sizeof(struct SystemTime));
  2124.  Buffer=((ULONG)PublicTime+(ULONG)sizeof(struct SystemTime));
  2125.  Message1=((ULONG)Buffer+100L);
  2126.  Message2=((ULONG)Message1+(ULONG)sizeof(struct Message));
  2127.  EMessage=((ULONG)Message2+(ULONG)sizeof(struct Message));
  2128.  SHelp=((ULONG)EMessage+(ULONG)sizeof(struct Message));
  2129.  ConsoleRequest=((ULONG)SHelp+(ULONG)sizeof(struct SHelp));
  2130.  Message1->mn_Length=sizeof(struct Message);
  2131.  Message2->mn_Length=sizeof(struct Message);
  2132.  EMessage->mn_Length=sizeof(struct Message);
  2133.  Message1->mn_Node.ln_Type=NT_MESSAGE;
  2134.  Message2->mn_Node.ln_Type=NT_MESSAGE;
  2135.  EMessage->mn_Node.ln_Type=NT_MESSAGE;
  2136.  Message1->mn_ReplyPort=Port3;
  2137.  Message2->mn_ReplyPort=Port3;
  2138.  MouseImage.ImageData=Chip;
  2139.  
  2140.  /* ----- Console-Device öffnen ---------------------------------------- */
  2141.  ConsoleDev=OpenDevice("console.device",-1L,ConsoleRequest,0);
  2142.  if(ConsoleDev!=0)
  2143.   {
  2144.    Fehlerbehandlung("ATKeyboard - Console-Device nicht ladbar");
  2145.   }
  2146.  ConsoleDevice=ConsoleRequest->io_Device;
  2147.  
  2148.  /* ----- TimerTask erstellen ------------------------------------------ */
  2149.  bool=ErstelleTimerTask();
  2150.  if(bool==FALSE)
  2151.   {
  2152.    Fehlerbehandlung(TRUE,"ATKeyboard - Fehler bei Task-Erstellung");
  2153.   }
  2154.  
  2155.  /* ----- ARexx installieren ------------------------------------------- */
  2156.  RexxSysBase=OpenLibrary("rexxsyslib.library",0L);
  2157.  if(RexxSysBase!=NULL)
  2158.   {
  2159.    ARexxPort=FindPort(ARexxName);
  2160.    if(ARexxPort==NULL)
  2161.     {
  2162.      ARexxPort=CreatePort(ARexxName,0);
  2163.      if(ARexxPort==NULL)
  2164.       {
  2165.        Fehlerbehandlung(TRUE,"ATKeyboard - Fehler beim ARexx-Port");
  2166.       }
  2167.      Prefs=AllocMem(sizeof(struct Einstellungen),MEMF_CLEAR|MEMF_PUBLIC);
  2168.      if(Prefs==NULL) Fehlerbehandlung(TRUE,"ATKeyboard - Kein Speicher für ARexx");
  2169.      ARexx=TRUE;
  2170.      ARexxSignal=ARexxPort->mp_SigBit;
  2171.      ARexxSignalMask=(1L<<ARexxSignal);
  2172.      WaitSignalMask+=ARexxSignalMask;
  2173.     }
  2174.    else
  2175.     {
  2176.      Requester("Information:","ARexx-Port existiert schon.","Okay",NULL);
  2177.      ARexxPort=NULL;
  2178.     }
  2179.   }
  2180.  if(ARexxPort==NULL)
  2181.   {
  2182.    if(KickstartVersion>=36)
  2183.     {
  2184.      SetWindowTitles(WindowPtr,"ACHTUNG: ARexx ist nicht möglich.",TitelText);
  2185.      Delay(50);
  2186.     }
  2187.   }
  2188.  
  2189.  /* ----- Clipboard installieren --------------------------------------- */
  2190.  
  2191.  ClipPort=CreatePort("ATKeyboard Clipboard Device Transfer Port",0L);
  2192.  if(ClipPort!=NULL)
  2193.   {
  2194.    ClipReq=CreateExtIO(ClipPort,sizeof(struct IOClipReq));
  2195.    if(ClipReq!=NULL)
  2196.     {
  2197.      ClipDev=OpenDevice("clipboard.device",0,ClipReq,0);
  2198.     }
  2199.   }
  2200.  if(ClipDev!=0)
  2201.   {
  2202.    SetWindowTitles(WindowPtr,"ACHTUNG: Clipboard nicht verfügbar.",TitelText);
  2203.    Clipboard_Item.Flags &= xITEMENABLED;
  2204.    Delay(50);
  2205.   }
  2206.  
  2207.  /* ----- Narrator installieren ---------------------------------------- */
  2208.  
  2209.  bool=InitNarrator();
  2210.  if(bool==FALSE)
  2211.   {
  2212.    SetWindowTitles(WindowPtr,"ACHTUNG: Narrator nicht verfügbar.",TitelText);
  2213.    Delay(50);
  2214.    Speak_Item.Flags &= xITEMENABLED;
  2215.    Speak=FALSE;
  2216.   }
  2217.  
  2218.  /* ----- Installation beenden ----------------------------------------- */
  2219.  Online=TRUE;
  2220.  SystemOK=TRUE;
  2221.  KontrolliereService();
  2222.  KontrolliereLPT1();
  2223.  KontrolliereUhr();
  2224.  KontrolliereSchoner();
  2225.  
  2226.  app=CreateAppItem(AppName);
  2227.  if(app!=NULL)
  2228.   {
  2229.    AppSignalMask=app->SignalMask;
  2230.    WaitSignalMask+=AppSignalMask;
  2231.   } else AppSignalMask=0;
  2232.  
  2233.  if(Einstellungen.HiFiPlayerAutoStart)
  2234.   {
  2235.    HiFiTime=1;
  2236.    if(Einstellungen.HiFiPlayerWaitActive) HiFiTime=Einstellungen.HiFiPlayerWait;
  2237.   }
  2238.  
  2239.  RegCheck();
  2240.  SetMenuStrip(WindowPtr,&Menu1);
  2241.  LeereIDCMP(WindowPtr);
  2242.  Say("welcome to a t keyboard");
  2243.  SetWindowTitles(WindowPtr,OnlineText,TitelText);
  2244. }
  2245.  
  2246.  
  2247. /* Programm beenden */
  2248. VOID CloseAll()
  2249. {
  2250.  if(RegWindow) DeleteStdWindow(RegWindow);
  2251.  if(app) DeleteAppItem(app);
  2252.  if(SysTestWindow) Close(SysTestWindow);
  2253.  if(Schoner)
  2254.   {
  2255.    Schoner=FALSE;
  2256.    KontrolliereSchoner();
  2257.   }
  2258.  if(LPT1)
  2259.   {
  2260.    LPT1=FALSE;
  2261.    KontrolliereLPT1();
  2262.   }
  2263.  if(WindowPtr)
  2264.   {
  2265.    ClearMenuStrip(WindowPtr);
  2266.    CloseWindow(WindowPtr);
  2267.   }
  2268.  if(SubTask)
  2269.   {
  2270.    PutMsg(Port4,Message1);
  2271.    WaitPort(Port3);
  2272.    GetMsg(Port3);
  2273.   }
  2274.  if(SystemOK==TRUE)
  2275.   {
  2276.    if(Einstellungen.SichernBeiEnde) SichereEinstellungen();
  2277.   }
  2278.  if(ConsoleDev==0) CloseDevice(ConsoleRequest);
  2279.  if(ClipDev==0) CloseDevice(ClipReq);
  2280.  if(TimeService) DeleteService(TimeService);
  2281.  if(FRTags) FreeTagItems(FRTags);
  2282.  if(FileRequester) FreeFileRequest(FileRequester);
  2283.  if(KeyboardInt) CleanupJanusSig(KeyboardInt);
  2284.  if(ServiceSignal!=-1) FreeSignal(ServiceSignal);
  2285.  if(TimerTaskSignal!=-1) FreeSignal(TimerTaskSignal);
  2286.  if(KeyboardSignal!=-1) FreeSignal(KeyboardSignal);
  2287.  if(SchonerFont) CloseFont(SchonerFont);
  2288.  if(SystemTime) FreeMem(SystemTime,MEMSIZE);
  2289.  if(Chip) FreeMem(Chip,16);
  2290.  if(KeyCodes) FreeMem(KeyCodes,sizeof(struct KeyCodes));
  2291.  if(Prefs!=NULL) FreeMem(Prefs,sizeof(struct Einstellungen));
  2292.  if(Port1) DeletePort(Port1);
  2293.  if(Port2) DeletePort(Port2);
  2294.  if(Port3) DeletePort(Port3);
  2295.  if(Port4) DeletePort(Port4);
  2296.  if(Port5) DeletePort(Port5);
  2297.  if(ClipReq) DeleteExtIO(ClipReq);
  2298.  if(ClipPort) DeletePort(ClipPort);
  2299.  if(ParallelRequest) DeleteExtIO(ParallelRequest);
  2300.  if(ParallelPort) DeletePort(ParallelPort);
  2301.  if(ARexxPort) DeletePort(ARexxPort);
  2302.  RemoveNarrator();
  2303.  if(NIL) Close(NIL);
  2304.  if(UtilityBase) CloseLibrary(UtilityBase);
  2305.  if(AslBase) CloseLibrary(AslBase);
  2306.  if(RexxSysBase) CloseLibrary(RexxSysBase);
  2307.  if(MathTransBase) CloseLibrary(MathTransBase);
  2308.  if(MathBase) CloseLibrary(MathBase);
  2309.  if(JanusBase) CloseLibrary(JanusBase);
  2310.  if(IconBase) CloseLibrary(IconBase);
  2311.  if(DiskfontBase)  CloseLibrary(DiskfontBase);
  2312.  if(ExpansionBase) CloseLibrary(ExpansionBase);
  2313.  if(TranslatorBase) CloseLibrary(TranslatorBase);
  2314.  if(ATUtilitiesBase)
  2315.   {
  2316.    if(Erweiterungen_Item.SubItem) DeleteUtilityList();
  2317.    CloseLibrary(ATUtilitiesBase);
  2318.   }
  2319.  if(IntuitionBase) CloseLibrary(IntuitionBase);
  2320.  if(GfxBase) CloseLibrary(GfxBase);
  2321.  exit(0);
  2322. }
  2323.  
  2324.  
  2325. /* ASCII-Daten an PC übertragen */
  2326. VOID Uebertragen()
  2327. {
  2328.  BOOL                        bool;
  2329.  REGISTER UBYTE             *name;
  2330.  REGISTER UBYTE             *Titel;
  2331.  register struct FileHandle *fh;
  2332.  
  2333.  if(Online==FALSE)
  2334.   {
  2335.    bool=Requester("Zum Übertragen muß ATKeyboard",
  2336.                   "auf \"Online\" gesetzt sein.",
  2337.                   "Gehe auf Online","Abbruch");
  2338.    if(bool==FALSE) return;
  2339.    XLine(TRUE);
  2340.   }
  2341.  bool=TRUE;
  2342.  do
  2343.   {
  2344.    if(FileRequester!=NULL)
  2345.     {
  2346.      name=FileReq("Datei an PC Übertragen","~(#?.info)");
  2347.     }
  2348.    else
  2349.     {
  2350.      name=StringAbfrage(TRUE,"Name der zu Übertragenden Datei:","");
  2351.     }
  2352.    if(name!=NULL)
  2353.     {
  2354.      fh=Open(name,MODE_OLDFILE);
  2355.      if(fh!=NULL)
  2356.       {
  2357.        Titel=WindowPtr->Title;
  2358.        SendeDatei(fh);
  2359.        SetWindowTitles(WindowPtr,Titel,TitelText);
  2360.        bool=FALSE;
  2361.       }
  2362.      else
  2363.       {
  2364.        bool=Requester("Die angegebene Datei konnte",
  2365.                       "nicht geöffnet werden.","Nochmal","Abbruch");
  2366.       }
  2367.     }
  2368.    else
  2369.     {
  2370.      bool=FALSE;
  2371.     }
  2372.   }
  2373.  while(bool==TRUE);
  2374. }
  2375.  
  2376.  
  2377. /* Clip übertragen */
  2378. VOID UebertrageClip()
  2379. {
  2380.  BOOL                        bool;
  2381.  REGISTER UBYTE             *name;
  2382.  REGISTER UBYTE             *Titel;
  2383.  register struct FileHandle *fh;
  2384.  
  2385.  if(Online==FALSE)
  2386.   {
  2387.    bool=Requester("Zum Übertragen muß ATKeyboard",
  2388.                   "auf \"Online\" gesetzt sein.",
  2389.                   "Gehe auf Online","Abbruch");
  2390.    if(bool==FALSE) return;
  2391.    XLine(TRUE);
  2392.   }
  2393.  SendeClip();
  2394. }
  2395.  
  2396.  
  2397. /* Utility-Manager aufrufen */
  2398. VOID Manager()
  2399. {
  2400.  REGISTER BOOL okay;
  2401.  
  2402.  okay=Execute(ManagerName,NULL,NIL);
  2403.  if(okay==FALSE)
  2404.   {
  2405.    InfoRequest("Utility-Manager konnte nicht gestartet werden.");
  2406.   }
  2407. }
  2408.  
  2409.  
  2410. /* Amiga und F-Taste gedrückt */
  2411. VOID FTaste(num,qualifier)
  2412.  UBYTE num;
  2413.  UWORD qualifier;
  2414. {
  2415.  UBYTE          *code;
  2416.  REGISTER UBYTE  typ,i;
  2417.  
  2418.  typ=0;
  2419.  if((qualifier & IEQUALIFIER_RSHIFT)||(qualifier & IEQUALIFIER_LSHIFT)) typ=1;
  2420.  if(qualifier & IEQUALIFIER_CONTROL) typ+=2;
  2421.  switch(typ)
  2422.   {
  2423.    case 1:
  2424.      code=KeyCodes->KeyTab[Einstellungen.Tastaturmodus].FTasten.FTastenShift[num];
  2425.     break;
  2426.    case 2:
  2427.      code=KeyCodes->KeyTab[Einstellungen.Tastaturmodus].FTasten.FTastenCtrl[num];
  2428.     break;
  2429.    case 3:
  2430.      code=KeyCodes->KeyTab[Einstellungen.Tastaturmodus].FTasten.FTastenShiftCtrl[num];
  2431.     break;
  2432.    default:
  2433.      code=KeyCodes->KeyTab[Einstellungen.Tastaturmodus].FTasten.FTasten[num];
  2434.     break;
  2435.   }
  2436.  if(code[0]!=0)
  2437.   {
  2438.    for(i=1;i<code[0];i++) Taste(code[i],0);
  2439.   }
  2440. }
  2441.  
  2442.  
  2443. /* Fehlerbehandlung */
  2444. VOID Fehlerbehandlung(menue,text)
  2445.  BOOL   menue;
  2446.  UBYTE *text;
  2447. {
  2448.  REGISTER ULONG  Class=LONELYMESSAGE;
  2449.  REGISTER BOOL   ende=FALSE;
  2450.  REGISTER WORD   ItemNum,MenuNum,SubItemNum,Code;
  2451.  register struct IntuiMessage *IMessage;
  2452.  
  2453.  if(menue==TRUE)
  2454.   {
  2455.    ClearMenuStrip(WindowPtr);
  2456.    Menu2.Flags &= xMENUENABLED;
  2457.    Menu3.Flags &= xMENUENABLED;
  2458.    Menu4.Flags &= xMENUENABLED;
  2459.    Menu5.Flags &= xMENUENABLED;
  2460.    if(JanusBase==NULL) Menu6.Flags &= xMENUENABLED;
  2461.    if(ATUtilitiesBase==NULL)
  2462.     {
  2463.      Information_Item.Flags &= xITEMENABLED;
  2464.      Manager_Item.Flags &= xITEMENABLED;
  2465.      Menu7.Flags &= xMENUENABLED;
  2466.      Menu8.Flags &= xMENUENABLED;
  2467.     }
  2468.    EinstellungenSichern_Item.Flags &= xITEMENABLED;
  2469.    EinstellungenLaden_Item.Flags &= xITEMENABLED;
  2470.    Erweiterungen_Item.Flags &= xITEMENABLED;
  2471.    EinstellungenAendern1_Item.Flags &= xITEMENABLED;
  2472.    EinstellungenAendern2_Item.Flags &= xITEMENABLED;
  2473.    Manager_Item.Flags &= xITEMENABLED;
  2474.    Uebertragen_Item.Flags &= xITEMENABLED;
  2475.    SetMenuStrip(WindowPtr,&Menu1);
  2476.   }
  2477.  SetWindowTitles(WindowPtr,text,TitelText);
  2478.  
  2479.  while(ende==FALSE)
  2480.   {
  2481.    WaitPort(WindowPtr->UserPort);
  2482.    IMessage=GetMsg(WindowPtr->UserPort);
  2483.    Class=IMessage->Class;
  2484.    Code=IMessage->Code;
  2485.    ReplyMsg(IMessage);
  2486.    switch(Class)
  2487.     {
  2488.      case CLOSEWINDOW:
  2489.        ende=TRUE;
  2490.       break;
  2491.      case MENUPICK:
  2492.        MenuNum=MENUNUM(Code);
  2493.        ItemNum=ITEMNUM(Code);
  2494.        SubItemNum=SUBNUM(Code);
  2495.        switch(MenuNum)
  2496.         {
  2497.          case MENU_DATEI:
  2498.            switch(ItemNum)
  2499.             {
  2500.              case ITEM_ENDE:
  2501.                ende=TRUE;
  2502.               break;
  2503.              case ITEM_INFORMATION:
  2504.                ShowInformation();
  2505.               break;
  2506.              case ITEM_MANAGER:
  2507.                Manager();
  2508.               break;
  2509.             }
  2510.           break;
  2511.          case MENU_ATPREFS:
  2512.            ATPrefs(ItemNum,SubItemNum);
  2513.           break;
  2514.          case MENU_HILFE:
  2515.            Hilfe(ItemNum);
  2516.           break;
  2517.          case MENU_HIFI:
  2518.            HiFi(ItemNum,SubItemNum);
  2519.           break;
  2520.         }
  2521.       break;
  2522.     }
  2523.   }
  2524.  CloseAll();
  2525. }
  2526.  
  2527.  
  2528. /* Requester erzeugen */
  2529. BOOL Requester(t1,t2,positiv,negativ)
  2530.  UBYTE *t1,*t2,*positiv,*negativ;
  2531. {
  2532.  REGISTER BOOL   bool;
  2533.  REGISTER UBYTE *Titel;
  2534.  
  2535.  Titel=WindowPtr->Title;
  2536.  SetWindowTitles(WindowPtr,"ATKeyboard - Requester",TitelText);
  2537.  ClearMenuStrip(WindowPtr);
  2538.  bool=MultiRequest(t1,t2,positiv,negativ);
  2539.  SetMenuStrip(WindowPtr,&Menu1);
  2540.  SetWindowTitles(WindowPtr,Titel,TitelText);
  2541.  return(bool);
  2542. }
  2543.  
  2544.  
  2545. /* ASL-Filerequester */
  2546. UBYTE *FileReq(titel,pattern)
  2547.  UBYTE *titel;
  2548.  UBYTE *pattern;
  2549. {
  2550.  REGISTER UBYTE *file;
  2551.  
  2552.  FRTags[0].ti_Data=(ULONG)pattern;
  2553.  FRTags[2].ti_Data=titel;
  2554.  file=NULL;
  2555.  strcpy(&FileBuffer,"");
  2556.  if(AslRequest(FileRequester,FRTags))
  2557.   {
  2558.    strcpy(&FileBuffer,FileRequester->rf_Dir);
  2559.    if((strlen(&FileBuffer))==0)
  2560.     {
  2561.      strcpy(&FileBuffer,FileRequester->rf_File);
  2562.     }
  2563.    else
  2564.     {
  2565.      switch(FileBuffer[strlen(&FileBuffer)-1])
  2566.       {
  2567.        case ' ':
  2568.        case ':':
  2569.         break;
  2570.        default:
  2571.          strcat(&FileBuffer,"/");
  2572.         break;
  2573.       }
  2574.      strcat(&FileBuffer,FileRequester->rf_File);
  2575.     }
  2576.    file=&FileBuffer;
  2577.   }
  2578.  return(file);
  2579. }
  2580.  
  2581.  
  2582. /* PC-Reset */
  2583. #asm
  2584.    public _ResetPC
  2585. _ResetPC:
  2586.    movem.l a0-a1/a6/d0-d2,-(sp)
  2587.    move.l _JanusBase,a6
  2588.    jsr -102(a6)
  2589.    moveq #0,d1
  2590.    movea.l d0,a0
  2591.    adda.l #524285,a0
  2592.    move.b (a0),d1
  2593.    andi.l #251,d1
  2594.    move.b d1,(a0)
  2595.    moveq #0,d2
  2596.    movea.l d0,a1
  2597.    adda.l #524277,a1
  2598.    move.b (a1),d2
  2599.    move.l #254,d1
  2600.    move.b d1,(a0)
  2601.    movem.l (sp)+,a0-a1/a6/d0-d2
  2602.    rts
  2603. #endasm
  2604.  
  2605.  
  2606. /* Tastentabelle setzen */
  2607. VOID SetzeTM(num)
  2608.  UWORD num;
  2609. {
  2610.  REGISTER WORD i;
  2611.  
  2612.  if(KeyCodes->KeyTab[num].Valid)
  2613.   {
  2614.    for(i=0;i<256;i++)
  2615.     {
  2616.      TastenTabelle[i]=KeyCodes->KeyTab[num].Keys[i];
  2617.     }
  2618.   }
  2619.  else
  2620.   {
  2621.    for(i=0;i<256;i++)
  2622.     {
  2623.      TastenTabelle[i]=KeyCodes->KeyTab[0].Keys[i];
  2624.     }
  2625.    Aktiv(&TM_Item[0]);
  2626.    for(i=1;i<=7;i++) Inaktiv(&TM_Item[i]);
  2627.   }
  2628.  Einstellungen.Tastaturmodus=num;
  2629. }
  2630.  
  2631.  
  2632. /* Hilfe-System aufrufen */
  2633. VOID Hilfe(num)
  2634.  UWORD num;
  2635. {
  2636.  
  2637.  switch(num)
  2638.   {
  2639.    case ITEM_HINDEX:
  2640.      Say("loading the online help's index");
  2641.      Help(HelpName,0);
  2642.     break;
  2643.    case ITEM_HDATEI:
  2644.      Help(HelpName,100);
  2645.     break;
  2646.    case ITEM_HTASTATUR:
  2647.      Help(HelpName,140);
  2648.     break;
  2649.    case ITEM_HBEFEHLE:
  2650.      Help(HelpName,160);
  2651.     break;
  2652.    case ITEM_HSCHONER:
  2653.      Help(HelpName,170);
  2654.     break;
  2655.    case ITEM_HLPT1:
  2656.      Help(HelpName,180);
  2657.     break;
  2658.    case ITEM_HATPREFS:
  2659.      Help(HelpName,190);
  2660.     break;
  2661.    case ITEM_HHIFI:
  2662.      Help(HelpName,198);
  2663.     break;
  2664.    case ITEM_HHILFE:
  2665.      Help(HelpName,210);
  2666.     break;
  2667.    case ITEM_AREXX:
  2668.      Help(HelpName,310);
  2669.     break;
  2670.    case ITEM_FEHLER:
  2671.      Help(HelpName,320);
  2672.     break;
  2673.   }
  2674. }
  2675.  
  2676.  
  2677. /* Registrierungsinformation */
  2678. VOID RegCheck()
  2679. {
  2680.  UBYTE                       str[60];
  2681.  REGISTER BOOL               bool;
  2682.  REGISTER UWORD              i,j;
  2683.  register struct FileHandle *fh;
  2684.  register struct RastPort   *rp;
  2685.  
  2686.  RegWindow=CreateStdWindow(NULL,75,110+BorderHeight(),450,42,0L,0L);
  2687.  if(RegWindow!=NULL)
  2688.   {
  2689.    rp=RegWindow->RPort;
  2690.    SetFont(rp,OpalFont);
  2691.    SelectStdFPen(rp);
  2692. #ifndef DEMO
  2693.    WriteText(rp,15,10,"ATKeyboard - Programminformation");
  2694.    WriteText(rp,15,23,"Sie benutzen die Vollversion von ATKeyboard,");
  2695.    sprintf(&str,"Version %ld.%ld vom %ld. %s %ld.",ATKeyboardVersion,
  2696.                                                   ATKeyboardRevision,
  2697.                                                   ATKeyboardTag,
  2698.                                                   ATKeyboardMonat,
  2699.                                                   ATKeyboardJahr);
  2700.    WriteText(rp,15,33,&str);
  2701.    RegTime=7;
  2702. #else
  2703.    WriteText(rp,15,23,"Dies ist eine eingeschränkte");
  2704.    WriteText(rp,15,33,"DEMO-VERSION von ATKeyboard!!!");
  2705.    RegTime=-1;
  2706. #endif
  2707.   }
  2708. }
  2709.  
  2710.  
  2711. /* HiFi-Player-Fernsteuerung */
  2712. VOID HiFi(num,sub)
  2713.  UWORD num,sub;
  2714. {
  2715.  UBYTE          str[50];
  2716.  REGISTER UBYTE x;
  2717.  REGISTER BOOL  bool;
  2718.  
  2719.  x=Einstellungen.HiFiPlayerNum;
  2720.  if(x>0)
  2721.    sprintf(&str,"ATAudio%ld:",x);
  2722.  
  2723.  bool=TRUE;
  2724.  
  2725.  switch(num)
  2726.   {
  2727.    case 7466:
  2728.      Say("starting audio player");
  2729.      if(x==0) UtilityQuiet(HiFiPort,1100); else EP(&str,"autostart");
  2730.     break;
  2731.    case ITEM_PLAY:
  2732.      Say("start playing");
  2733.      if(x==0) bool=UtilityQuiet(HiFiPort,1001); else EP(&str,"play");
  2734.     break;
  2735.    case ITEM_STOP:
  2736.      Say("stop playing");
  2737.      if(x==0) bool=UtilityQuiet(HiFiPort,1002); else EP(&str,"stop");
  2738.     break;
  2739.    case ITEM_JUMP:
  2740.      switch(sub)
  2741.       {
  2742.        case SUBITEM_TFIRST:
  2743.          Say("playing the first song");
  2744.          if(x==0) bool=UtilityQuiet(HiFiPort,1003); else EP(&str,"first");
  2745.         break;
  2746.        case SUBITEM_TLAST:
  2747.          Say("playing the last song");
  2748.          if(x==0) bool=UtilityQuiet(HiFiPort,1004); else EP(&str,"last");
  2749.         break;
  2750.        case SUBITEM_TNEXT:
  2751.          Say("playing the next song");
  2752.          if(x==0) bool=UtilityQuiet(HiFiPort,1005); else EP(&str,"next");
  2753.         break;
  2754.        case SUBITEM_TPREV:
  2755.          Say("playing the previous song");
  2756.          if(x==0) bool=UtilityQuiet(HiFiPort,1006); else EP(&str,"prev");
  2757.         break;
  2758.        case SUBITEM_TRND:
  2759.          Say("playing a song chosen by random numbers");
  2760.          if(x==0) bool=UtilityQuiet(HiFiPort,1500); else EP(&str,"rnd");
  2761.         break;
  2762.       }
  2763.     break;
  2764.    case ITEM_KBEARBEITEN:
  2765.      if(x==0) bool=UtilityQuiet(HiFiPort,1007); else EP(&str,"edit");
  2766.     break;
  2767.    case ITEM_KLADEN:
  2768.      if(x==0) bool=UtilityQuiet(HiFiPort,1008); else EP(&str,"load");
  2769.     break;
  2770.    case ITEM_KSICHERN:
  2771.      if(x==0) bool=UtilityQuiet(HiFiPort,1009); else EP(&str,"save");
  2772.     break;
  2773.    case ITEM_AUAENDERN:
  2774.      if(x==0) bool=UtilityQuiet(HiFiPort,1010); else EP(&str,"prefs");
  2775.     break;
  2776.    case ITEM_PLAENDERN:
  2777.      Auswahl();
  2778.     break;
  2779.    case ITEM_HIFICTRL:
  2780.      if(x==0)
  2781.        bool=UtilityQuiet(HiFiPort,1012);
  2782.      else
  2783.        EP(&str,"display");
  2784.      Delay(50);
  2785.      ActivateWindow(WindowPtr);
  2786.     break;
  2787.    case ITEM_LAUTER:
  2788.      Say("increasing the volume");
  2789.      if(x==0) bool=UtilityQuiet(HiFiPort,1013); else EP(&str,"vol+");
  2790.     break;
  2791.    case ITEM_LEISER:
  2792.      Say("decreasing the volume");
  2793.      if(x==0) bool=UtilityQuiet(HiFiPort,1014); else EP(&str,"vol-");
  2794.     break;
  2795.    case ITEM_HIFIENDE:
  2796.      Say("removing the audio player");
  2797.      if(x==0) bool=UtilityQuiet(HiFiPort,UTILITY_QUIT); else EP(&str,"quit");
  2798.     break;
  2799.    default:
  2800.      bool=TRUE;
  2801.     break;
  2802.   }
  2803.  if(bool==FALSE) DisplayBeep(NULL);
  2804. }
  2805.  
  2806.  
  2807. /* Kommandos an externe Player geben */
  2808. VOID EP(dir,cmd)
  2809.  UBYTE *dir,*cmd;
  2810. {
  2811.  UBYTE str[80];
  2812.  
  2813.  if(Einstellungen.HiFiPlayerARexx==NO)
  2814.    strcpy(&str,"Run Execute ");
  2815.  else
  2816.    strcpy(&str,"Run SYS:REXXC/RX ");
  2817.  strcat(&str,dir);
  2818.  strcat(&str,cmd);
  2819.  if(Einstellungen.HiFiPlayerARexx)
  2820.    strcat(&str,".rexx");
  2821.  Execute(&str,NULL,NIL);
  2822. }
  2823.  
  2824.  
  2825. /* HiFi-Player Auswahl */
  2826. UBYTE *PlayerNames[]={"ATUtilities HiFi-Player",
  2827.                       "Externer Player 1",
  2828.                       "Externer Player 2",
  2829.                       "Externer Player 3",
  2830.                       "Externer Player 4",
  2831.                       "Externer Player 5"};
  2832.  
  2833. VOID Auswahl()
  2834. {
  2835.  UBYTE                        *vz,*Titel;
  2836.  UBYTE                         str[8];
  2837.  REGISTER BOOL                 ende;
  2838.  REGISTER ULONG                Class;
  2839.  register struct Gadget       *gad,*autos,*verz,*rxx;
  2840.  register struct Window       *win;
  2841.  register struct RastPort     *rp;
  2842.  register struct IntuiMessage *msg;
  2843.  
  2844.  ClearMenuStrip(WindowPtr);
  2845.  Titel=WindowPtr->Title;
  2846.  SetWindowTitles(WindowPtr,TitelText,TitelText);
  2847.  
  2848.  win=CreateStdWindow("Audio - Auswahl des externen Players",75,75,450,108,
  2849.                      CLOSEWINDOW|GADGETUP,
  2850.                      ACTIVATE|WINDOWDEPTH|WINDOWDRAG|WINDOWCLOSE);
  2851.  if(win!=NULL)
  2852.   {
  2853.    rp=win->RPort;
  2854.    SetFont(rp,GetOpalFont());
  2855.    CreateBoolGadget(win,15,15,25,12,"»",1);
  2856.    DrawNTextBorder(win,45,15,390,12,PlayerNames[Einstellungen.HiFiPlayerNum]);
  2857.    if(Einstellungen.HiFiPlayerAutoStart!=0)
  2858.      autos=CreateSToggleGadget(win,15,58,420,12,"Auto-Start durch ATKeyboard",20);
  2859.    else
  2860.      autos=CreateNToggleGadget(win,15,58,420,12,"Auto-Start durch ATKeyboard",20);
  2861.    if(Einstellungen.HiFiPlayerWaitActive!=0)
  2862.      verz=CreateSToggleGadget(win,15,73,420,12,"Verzögerung des Auto-Starts",30);
  2863.    else
  2864.      verz=CreateNToggleGadget(win,15,73,420,12,"Verzögerung des Auto-Starts",30);
  2865.    if(Einstellungen.HiFiPlayerARexx!=0)
  2866.      rxx=CreateSToggleGadget(win,15,40,420,12,"Befehlsskripte als ARexx-Befehl aufrufen",30);
  2867.    else
  2868.      rxx=CreateNToggleGadget(win,15,40,420,12,"Befehlsskripte als ARexx-Befehl aufrufen",30);
  2869.    sprintf(&str,"%ld",Einstellungen.HiFiPlayerWait);
  2870.    vz=CreateIntegerGadget(win,385,88,50,12,&str,5,10);
  2871.    SelectStdFPen(rp);
  2872.    WriteText(rp,25,96,"Verzögerung in Sekunden:");
  2873.  
  2874.    ende=FALSE;
  2875.    while(ende==FALSE)
  2876.     {
  2877.      WaitPort(win->UserPort);
  2878.      msg=GetMsg(win->UserPort);
  2879.      Class=msg->Class;
  2880.      gad=msg->IAddress;
  2881.      ReplyMsg(msg);
  2882.      switch(Class)
  2883.       {
  2884.        case CLOSEWINDOW:
  2885.          ende=TRUE;
  2886.         break;
  2887.        case GADGETUP:
  2888.          switch(gad->GadgetID)
  2889.           {
  2890.            case 1:
  2891.              Einstellungen.HiFiPlayerNum+=1;
  2892.              if(Einstellungen.HiFiPlayerNum>5) Einstellungen.HiFiPlayerNum=0;
  2893.              DrawCNTextBorder(win,45,15,390,12,PlayerNames[Einstellungen.HiFiPlayerNum]);
  2894.             break;
  2895.           }
  2896.         break;
  2897.       }
  2898.     }
  2899.    if(autos->Flags & SELECTED) Einstellungen.HiFiPlayerAutoStart=1; else Einstellungen.HiFiPlayerAutoStart=0;
  2900.    if(verz->Flags & SELECTED) Einstellungen.HiFiPlayerWaitActive=1; else Einstellungen.HiFiPlayerWaitActive=0;
  2901.    if(rxx->Flags & SELECTED) Einstellungen.HiFiPlayerARexx=1; else Einstellungen.HiFiPlayerARexx=0;
  2902.    Einstellungen.HiFiPlayerWait=atol(vz);
  2903.    DeleteStdWindow(win);
  2904.   }
  2905.  SetWindowTitles(WindowPtr,Titel,TitelText);
  2906.  SetMenuStrip(WindowPtr,&Menu1);
  2907. }
  2908.  
  2909.